Concept → IO ()

Linux Emacs Coding Music Links About Search

Zip folders with GNU Parallel

Working with large files takes a long time. Sometimes, it is worth to zip folders individually, so that a single archive does not get too large. GNU Parallel is a shell tool to execute jobs in parallel. Here, I show one of possibly many methods to use it to zip many folders (or files) in parallel.

  1. Create a file with all folders that you want to zip, e.g with:
ls -1 > folders
  1. Use GNU Parallel to zip them:
parallel -a folders "tar -czf {}.tar.gz {}"

In order to unzip many files at ones (this method can also be used to zip the files if their names follow certain patterns):

parallel "tar -xzf {}" ::: *.tar.gz