Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

2 Answers 2

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.