Louis I. answered 06/09/20
Computer Science Instructor/Tutor: Real World and Academia Experienced
Hi. As rich as the "find" command is, I fon't think there's an option
that asks "find" to ignore a specific directory.
But, we're talk "shell" here - there's always a way out! ;-)
1) you can always pipe the output of find into a filter - such as this:
find . -name "*.js" | grep -v "^UnwantedDir"
2) Since you're already using 'find' as part of a loop, you can always
do something programmatic like this:
for file in $(find . -name "*.js" )
do
[[ "$file" =~ ^./UnwantedDir.* ]] && continue
## get your work done
done
3) create a script to do the filtering and the actual work to be completed, and call that
script from the find "-exec" option ... as follows:
find . -name "*.js" -exec doSomeWork {} \;
So you can compensate for the fact that "find" may not have the option
you're looking for with a bit of ingenuity ...