If you'd like to prune any directory called either .git
or node_modules
from the search tree, you would use
-type d \( -name .git -o -name node_modules \) -prune
This would cause find
to not even enter these directories (the -type d
is not strictly necessary, but I'll use it here for symmetry with -type f
; see below).
Then you would add the other conditions,
-type d \( -name .git -o -name node_modules \) -prune -o \
-type f \( -name '*.yaml' -o -name '*.html' \) -print
Ending up with
find . \
-type d \( -name .git -o -name node_modules \) -prune -o \
-type f \( -name '*.yaml' -o -name '*.html' \) -print
Any action that you'd like to take on the pathnames that passes all tests should be done in place of the -print
.
Note that the default logical operation between two predicates is -a
(AND).