12

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?

  • 2
    Could you give an example? – ztik Dec 23 '14 at 11:38
  • Are you looking for a manual or a completely automated solution? – David Foerster Dec 23 '14 at 13:48
  • just a note, normally when you find that kind of torrents it about illegal software/movies, and you'll never actually get to the end of those .rar/.zip files because it's fake. – Jeggy Dec 23 '14 at 13:51
16

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.

  • According to the manual unzip doesn't support split archives (see the first paragraph in the section “Bugs”). – David Foerster Dec 23 '14 at 13:10
  • @DavidFoerster just tested it, and it works. – Mitch Dec 23 '14 at 14:03
  • Ok, then the manual appears to be wrong. Good catch. – David Foerster Dec 23 '14 at 14:38
  • @mitch in my case it doesnt work it sais "error while loading the zip file" but on windows the same directory on the same disk unzips with winrar, maybe you tried to unzip multiple but >separate< zip file simultanously? thats an other thing though. – papajo Oct 11 '17 at 0:39
2

To unzip multiple files using a loop -

for z in *.zip; do unzip "$z"; done
  • @DavidFoerster The two methods are essentially the same. *.zip provides all the possible files ending with a zip extension which the loop unzips one by one. This is also why @Mitch has included single quotes in his answer to make it '*.zip', so that the the shell will not recognize it as a wild card character. – Rohith Madhavan Dec 23 '14 at 17:08
  • 1
    This is actually a better method since you can specify a file name list instead of saying "all files in the directory". I.E. you want to extract a specific list of zip files one after the other in order, you could do, "for z in X Y Z T G; do unzip -o "$z.zip"; done" and it would do it in that order. This is the better answer imho. – John Hamilton Aug 23 '17 at 8:29
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)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.