I have a find command that looks for files that was modified recently and outputs the date
find /path/on/server -mtime -1 -name '*.js' -exec ls -l {} \;
I would like it to exclude any deeply nested folder that matches a certain pattern e.g. there are a number of folders that have a "statistics" directory and ".svn" directories. So i'd like to be able to say if the file that was modified yesterday is in a folder named statistics ignore it. Or perhaps not search for files in those folders at all.
Best Answer
You can use the
-path
and-prune
command line parameters to do thisThis has the advantage of not searching the directories that you want excluding.
Also note that your
ls -l
may not be doing what you expect as it will list the entire contents of directories that are passed to it so you will get some files listed multiple times.From the comments
ls -ld
would be better.