Batch export for files

Hello Drishti,

This is a great question. You are almost there!

There are a lot of ways to do this, but here is one method I've used before that uses only basic linux. It has three steps.

# set variables for input and output folder!
input=/full/file/path/to/beta/core-metrics-phylo
output=newoutputfolder


# Find the part of the name that changes and save it to a file. 
cd $inputpath
ls *emperor.qzv > $output/filenames.txt
head $output/filenames.txt

# Loop through all filenames and export them. 
while read i; do
        echo exporting $i
        qiime tools export ${i} --output-dir $output/${i} 
done < $output/filenames.txt

Note that I use $i twice; first to read in each file, second to write out each file to a new directory.

Let me know if this method works for you!

Colin

3 Likes