← Back to context

Comment by HankStallone

8 hours ago

  find . -type f -name '*.foo' -not -path '*/.*' -print0 | xargs -0 grep bar

The one issue with this approach is that it would still traverse all hidden folders, which could be expensive (e.g. in a git repo with an enormous revision history in `.git/`). `-not -path ...` just prevents entities from being printed, not being traversed. To actually prevent traversal, you need to use `-prune`.