4 Answers 4
Is that what you mean?
find . \( \! -iregex ^./bin/.\* -o -iregex ^./include/something/.\* \) \
-name \*.php
answered Dec 9, 2009 at 9:15
Michael Krelin - hacker
6965 silver badges7 bronze badges
-
No - but I've rewrote the question so hopefully I'm explaining myself better now.yoavf– yoavf2009年12月09日 09:20:12 +00:00Commented Dec 9, 2009 at 9:20
-
yoavf, so I've edited my replyMichael Krelin - hacker– Michael Krelin - hacker2009年12月09日 09:47:17 +00:00Commented Dec 9, 2009 at 9:47
find /bin /bin/php -maxdepth 1 -name "*.php"
Proof of concept
$ tree /bin /bin |-- ash |-- dont_search | |-- hide_me.php | `-- hide_me.txt |-- du |-- file.php |-- fmt |-- php | |-- hide_me.txt | `-- show_me.php `-- zsh 2 directories, 184 files
Result
$ find /bin /bin/php -maxdepth 1 -name "*.php" /bin/file.php /bin/php/show_me.php
Notice that /bin/dont_search/hide_me.php did not match
answered Dec 9, 2009 at 10:50
SiegeX
2,4673 gold badges18 silver badges21 bronze badges
Try this:
find . ./bin/php -path ./bin -prune -o -print
This will ignore files that are within ./bin, too, though.
By the way, it's "find" rather than "Bash find".
answered Dec 9, 2009 at 12:13
Dennis Williamson
112k21 gold badges178 silver badges192 bronze badges
GNU find
find . -name "*.txt" ! -iregex ".*/bin/.*"
You must log in to answer this question.
lang-bash