shell - Exclude Library folder from being searched with find command in Terminal–OS X Mavericks -
i'm trying make applescript searches specific folder called keypro inside user's home folder. i'm using following code in applescript this:
do shell script "find ~/ -name 'keypro'"
(the "~/" means search inside current user's home folder.)
what's annoying every time run it, terminal searches inside library folder causes "permission denied" error, other random stuff showing up.
is there way exclude user's library folder being searched?
originally tagging question shell or, more specficially, find-util have gotten more attention (terminal doesn't come play here - applescript's do shell script
doesn't open terminal window, merely creates shell child process.).
do shell script "find ~ -path ~/library -prune -o -name 'keypro' -print"
will exclude ~/library
find command.
from shell, run man find
more information on find
command.
however, note wouldn't ordinarily see warnings or error messages when use applescript's do shell script
, unless shell command fails (reports nonzero exit code) whole (in case applescript throws error shell error message description).
warnings , error message sent stderr stream, whereas do shell script
default captures stdout.
Comments
Post a Comment