Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I run a find command to find php files but I exclude a folder i.e. /usr/local/bin?

share|improve this question

Prune it.

find some/dir \( -type d -path some/dir/some/other/dir -prune -o -name '*.php' -print \)
share|improve this answer

You can use the find command in linux to do this. Something like this should work.

find / \! -path "/usr/local/bin/*" -name "*.php"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.