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

Currently I have this find command which avoids descending particular directories:

find . \! \( -name ".hg" -prune \) \! \( -name "localhost" -prune \) \! \( -name "logs" -prune \) -type f

The command works like I want it to, but I'm looking for a more succinct solution. I feel like I'm repeating myself a lot, and there must be a more elegant/shorter way to accomplish the same thing.

share|improve this question

2 Answers 2

find . \( \( -name .hg -o -name localhost -o -name logs \) -prune \) -o -type f
share|improve this answer
find . -not \( -regex ".*/(.hg|localhost|logs)" -prune \) -type f
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.