Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have a file with joker character patterns:




From the current directory I would like to recursively get the list of files that do not match these patterns.

share|improve this question
up vote 5 down vote accepted
find . -type f \! \( -path '*/include/*' -o -path '*/src/*' \)


  • \! is negating the group
  • \( ... \) is how to do groups of conditions for find
  • -o ORs conditions
  • Everything else should be self-explanatory.

If you have a new enough version of find, you could enhance it with:

find . -type f -regextype posix-egrep -regex \! -path '.*/(include|src)/.*'
share|improve this answer
Your reputation improves as well when you accept answers. ::prod:: – Brian Vandenberg May 5 '11 at 7:22
Chill out man, we are probably in different timezones... Thanks for the answer. :) – Tamás Szelei May 5 '11 at 8:52
np, was just giving a friendly reminder =) – Brian Vandenberg May 5 '11 at 8:53
Dude. This response is excellent! – macetw Jan 19 at 16:12

First approach, but not using a list of files, others feel free to improve on that:

find . -type f -print | grep -v '.\/src\/*'
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.