Exclude subdirectories from find

java -jar ~/Downloads/simian-2.3.35/bin/simian-2.3.35.jar files $(find ~/App/Classes/ -type f -name "*.m"  -not -path  "Lib/excludethisdir/*")

I am trying to run simian and pass a file argument to it, but the directory exception just doesn't work. Lib directory is in classes

Can anyone indicate why it does not work (the command is launched, but this does not exclude)

+4
source share
1 answer

The nested find command should be:

find ~/App/Classes/ -type f -name "*.m"  -not -path "./Lib/excludethisdir/*"

i.e. add ./before your excluded path.

Or even better:

find ~/App/Classes/ -path "./Lib/excludethisdir/*" -prune -o -type f -name "*.m" -print
+7
source

All Articles