I wanted to find all files in my repository and check them for line endings (which according to the rule of Chris is one of the three root causes to all problems in software). I didn’t want to list all the git files, nor the files generated by my editor (PyCharm creates an ‘.idea’ directory in each project it opens).

Here’s how to exclude multiple directories from a find for all files:

find . -type f -not \( -path "./.git/*" -o -path "./.idea/*" \)