Find all files excluding multiple directories and pipe to something else, i.e. dos2unix:

find . -type d \( -name .git -o -name node_modules \) -prune -o \
-type f -print0 | xargs -0 -n 1 dos2unix

Aka find the directories to exclude and prune them then find the files you want.

  • -o means or
  • -print0 | xargs -0 keeps spaces in paths from creating problems
  • -n 1 means process one at a time (aka you can batch 10 processes with -n 10