Shell – Running command on multiple files within multiple directories

directoryfilesosxshell

I want to run the command

python quast.py -o quast contigs.fasta

but I want to do this for multiple contigs.fasta files in multiple directories.

I'm running OSX.

Best Answer

You can use the find command to help you run it multiples times. It should be something like:

find /your_dev_dir -name "contigs.fasta" -exec python quast.py -o quast {} \;

This runs the command on every file called contigs.fasta that is in /your_dev_dir, or a subdirectory of that directory, or a subsubdirectory recursively.

Related Question