linux - Exclude range of directories in find command -


i have directory called test has sub folders in date range 01,02,...31. sub folders contain .bz2 files in it. need search files .bz2 extension using find command excluding particular range of directories. know find . -name ".bz2" -not -path "./01/*", writing -not -path "./01/*" pathetic if want skip 10 directories. how skip 01..19 subdirectories in find command ?

you can use wildcards in pattern option -not -path:

find ./ -type f -name "*.bz2" -not -path "./0*/*" -not -path "./1*/* 

this exclude directories starting 0 or 1. or better:

find ./ -type f -name "*.bz2" -not -path "./[01]*/*" 

Comments