I am no expert at this (and this page was very helpful along with http://mywiki.wooledge.org/UsingFind)
Just noticed -path
is for a path that fully matches the string/path that comes just after find
(.
in theses examples) where as -name
matches all basenames.
find . -path ./.git -prune -o -name file -print
blocks the .git directory in your current directory ( as your finding in .
)
find . -name .git -prune -o -name file -print
blocks all .git subdirectories recursively.
Note the ./
is extremely important!! -path
must match a path anchored to .
or whatever comes just after find if you get matches with out it (from the other side of the or '-o
') there probably not being pruned!
I was naively unaware of this and it put me of using -path when it is great when you don't want to prune all subdirectory with the same basename :D