Filter the path
suggest changeThe -path parameter lets you specify a pattern to match the path of the result. The pattern can also match the name itself.
To find only files containing log anywhere in their path (folder or name):
find . -type f -path '*log*'
To find only files within a folder called log (on any level):
find . -type f -path '*/log/*'
To find only files within a folder called log or data:
find . -type f \( -path '*/log/*' -o -path '*/data/*' \)
To find all files except the ones contained in a folder called bin:
find . -type f -not -path '*/bin/*'
To find all files except the ones contained in a folder called bin, or log files:
find . -type f -not -path '*log' -not -path '*/bin/*'
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents