FILES=`find . -type f -name '*.js'`
for file in $FILES
do
# some task
done
This will loop over all *.js files but let's say there are some .spec.js files as well which I want to skip.
a.js
a.spec.js
b.js
x.spec.js
c.js
should iterate over:
a.js
b.js
c.js
this is the code you looking for :
find . -type f \( -iname "*.js" -not -iname "*.spec.js" \)