linux - Exclude list of files from find -


if have list of filenames in text file want exclude when run find, how can that? example, want like:

find /dir -name "*.gz" -exclude_from skip_files 

and .gz files in /dir except files listed in skip_files. find has no -exclude_from flag. how can skip files in skip_files?

i don't think find has option this, build command using printf , exclude list:

find /dir -name "*.gz" $(printf "! -name %s " $(cat skip_files)) 

which same doing:

find /dir -name "*.gz" ! -name first_skip ! -name second_skip .... etc 

alternatively can pipe find grep:

find /dir -name "*.gz" | grep -vff skip_files 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -