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: 76
Total answers/comments: 2
Guest [Entry]

"Is that what you mean?

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

"GNU find

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