I\'m trying to run a find command for all JavaScript files, but how do I exclude a specific directory?
Here is the find code we\'re using.<
find . \( -path '.**/.git' -o -path '.**/.hg' \) -prune -o -name '*.js' -print
The example above finds all *.js files under the current directory, excluding folders .git and .hg, does not matter how deep these .git and .hg folders are.
Note: this also works:
find . \( -path '.*/.git' -o -path '.*/.hg' \) -prune -o -name '*.js' -print
but I prefer the ** notation for consistency with some other tools which would be off topic here.