Exclude directories with the find command
Created on October 22, 2025
linux/cli
❯ find . -iname '*.md' -not -path '*.venv/*' -not -path '*node_modules/*'
Problem with this: it still traverses each directory, just excludes it from the output. Very inefficient…
Apparently, there is a way to use it with -prune to avoid recursing the excluded directories, but the API seems very clunky. I prefer the easy interface for now.
Reference: https://stackoverflow.com/a/24565095