I have a command that looks through all my sub folders for files, however I want it to skip a folder from the search and I’m not sure what is the right way to do this:
find -name '*.avi' -o -name '*.mkv' -o -name '*.mp4' -o -name '*.vob'
I want it to not look into the folder name: secure
I tried:
find -name '*.avi' -o -name '*.mkv' -o -name '*.mp4' -o -name '*.vob' --skip 'secure'
but it does not work.
Thanks for your help in advance.
There is no –skip argument in GNU find. But you can do what you want using the
-pathand-pruneexpressions. The syntax is a little weird: you use-path ./secure -pruneas a term which you then OR with the rest of the expression. So in your case:find . -name '*.avi' -o [...] -o -path ./secure -pruneNote that this will still return the directory
./securein the results, but nothing inside it.