Find command exclude files whose path match a certain pattern

Posted by user40570 on Server Fault See other posts from Server Fault or by user40570
Published on 2012-07-06T17:48:07Z Indexed on 2012/07/06 21:19 UTC
Read the original article Hit count: 191

Filed under:

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.

© Server Fault or respective owner

Related posts about linux