find
Loop over all files in all sub-directories
Loop over all files in all sub-directories
# show all .fasta files in all sub-directories of folder 'assembly'
find assembly/ -name "*.fasta"
assembly/projectA/run1.fasta
assembly/projectA/run2.fasta
assembly/projectB/run1.fasta
assembly/projectB/run2.fasta
assembly/final.fasta
# search for 'plasmid' in all fasta files (run command grep on all files) in folder 'assembly'
find assembly/ -name "*.fasta" -exec grep --with-filename plasmid {} \;
# compress all .fasta files using gzip, include all sub-directories of folder 'assembly'
find assembly/ -name "*.fasta" -exec gzip {} \;
General
General
find /path/ -name filter files -exec run command {} \;
-name # filter filenames
-exec # run command
{} # on each file
\; # pass files one by one to the command