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.
for file in $(find . -name '*.js')
do
java -jar config/yuicompressor-2.4.2.jar --type js $file -o $file
done
This is the only one that worked for me.
Searching for "NameOfFile" excluding "Directory". Give emphasis to the stars * .
For those of you on older versions of UNIX who cannot use -path or -not
Tested on SunOS 5.10 bash 3.2 and SunOS 5.11 bash 4.4
If
-prune
doesn't work for you, this will:This is the format I used to exclude some paths:
I used this to find all files not in ".*" paths:
seems to work the same as
and is easier to remember IMO.