Nabil-Fareed Alikhan

Bioinformatics · Microbial Genomics · Software Development

How zip up a folder of loose FASTQ files

Posted on July 16, 2020

an AI generated picture (Midjourney) with prompt; 'computer servers tall  interior :: concept art :: green'. You can share and adapt this image following a CC BY-SA 4.0 licence

The problem is to find all fastq files, and submit each one, one by one as a job to be gzipped.

Local machine

ls *.fastq | xargs -I {} gzip {}

Multicore version

You will need to have pigz installed.

ls *.fastq | xargs -I {} pigz {}

Compute cluster - HPC

This really applies if you are working on a computing cluster (SLURM).

ls *.fastq | xargs -I {} sbatch --wrap="gzip {}"

Multicore version

You will need to have pigz installed.

ls *.fastq | xargs -I {} sbatch --wrap="pigz {}"