28

I don't think that I'm the only one with this problem, but unfortunately I wasn't able to find the proper answer between previously asked questions.

It is a very common procedure on torrent sites where the content is split in many small archives. Sometimes, those small indexed zip archives are containing another rar archives inside.

So, my question is: how to you handle this problem? How to you recursively unpack those files?

Braiam
  • 69,112
rda
  • 487

4 Answers4

39

To do so, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

unzip '*.zip'

Also you can right click on the first file in the group, and choose Extract here, and that will also all the files in that group.

Mitch
  • 109,787
6

To unzip multiple files using a loop -

for z in *.zip; do unzip "$z"; done
1

How to unzip multiple files at once

...using parallel operations (one CPU core per process, with as many processes as you have cores), into output directories with the same names as the zip files:

This might look complicated, but it's beautiful and fast. It will unzip all top-level *.zip files in your current directory into folders of the same name as the zip file:

# Install `unar` (un-archive)
sudo apt update
sudo apt install unar

Unzip all files

time find . -maxdepth 1 -type f -iname "*.zip" -print0 | xargs -0 -I{} -n 1 -P $(nproc) unar -f {}

  • unar is used instead of unzip because unar automatically puts the extracted output into a folder with the same name as the .zip file.
  • If you'd like to extract *.zip files in lower levels too, remove the -maxdepth 1 option.

References

  1. Unix & Linux: Unzip to a folder with the same name as the file (without the .zip extension)
  2. My answer on how to use xargs

See also

  1. My longer answer, based on the work above, where I extract one or many password-protected files in parallel using find, xargs, and unar -p my_password path/to/myfile.zip.
Gabriel Staples
  • 11,502
  • 14
  • 97
  • 142
0

CTRL+ALT+T to open up a terminal

for f in $(ls | egrep zip); do
  unzip $f -vd UnzippedDirectory
done

This basically loops through all the zips you got in your current directory, and unzips each of them verbose (hence the -v flag) into a directory (-d flag)