Zip folders with GNU Parallel
Jan 7, 2015 · 1 minute read · LinuxWorking 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.
- Create a file with all folders that you want to zip, e.g with:
ls -1 > folders
- 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