Home » Questions » Computers [ Ask a new question ]

How can I restrict find to only search specific sub-directories?

How can I restrict find to only search specific sub-directories?

I am using find in a Bash script. How can I modify that code to include a specific directory under 'bin' , ie './bin/php/' (while still ignoring all other sub-directories of 'bin')?

Asked by: Guest | Views: 276
Total answers/comments: 2
bert [Entry]

"Is that what you mean?

find . \( \! -iregex ^./bin/.\* -o -iregex ^./include/something/.\* \) \
-name \*.php"
bert [Entry]

"GNU find

find . -name ""*.txt"" ! -iregex "".*/bin/.*"""