I have a file with joker character patterns:
./include/*
./src/*
etc.
From the current directory I would like to recursively get the list of files that do not match these patterns.
find . -type f \! \( -path '*/include/*' -o -path '*/src/*' \)
Breakdown:
\!
is negating the group\( ... \)
is how to do groups of conditions for find
-o
ORs conditionsIf you have a new enough version of find
, you could enhance it with:
find . -type f -regextype posix-egrep -regex \! -path '.*/(include|src)/.*'
First approach, but not using a list of files, others feel free to improve on that:
find . -type f -print | grep -v '.\/src\/*'