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

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
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

 
discard

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.