Macos – Unzip Multipart Zip from Command Line

macosterminalzip

Thanks in advance for any help. I am trying to unzip a multipart zip file from the command line in OSX 10.8.5.

I created the zip using zip -s 800m foo.zip foo.mov

The file foo.mov is 2.7GB. So I have the files: foo.zip, foo.z01, foo.z02, foo.z03.

I tried using zip -s 0 foo.zip -O foo_unsplit.zip, but then foo_unsplit.zip is only 1.6GB and gives the error below when used with unzip.

error:  invalid compressed data to inflate

I also tried using cat Heritage.zip Heritage.z01 Heritage.z02 Heritage.z03 > Heritage_unsplit.zip but unzipping the result file gives the below result:

unzip Heritage_unsplit.zip 
Archive:  Heritage_unsplit.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of Heritage_unsplit.zip or
        Heritage_unsplit.zip.zip, and cannot find Heritage_unsplit.zip.ZIP, period.

Does anyone know of a way to unzip a multipart file in command line. Have I made a mistake in any of my attempts?

Best Answer

I'm assuming this is different between MacOS versions - I'm currently running High Sierra and unzip is still not supporting multipart properly - but I did the same trick with cat but in reverse order and it worked.

i.e. cat Heritage.z03 Heritage.z02 Heritage.z01 Heritage.zip > Heritage_unsplit.zip Then unzip on it worked.

I got some errors like the ones below, but the files are binary equal:

> unzip big.zip
Archive:  big.zip
warning [big.zip]:  zipfile claims to be last disk of a multi-part archive;
  attempting to process anyway, assuming all parts have been concatenated
  together in order.  Expect "errors" and warnings...true multi-part support
  doesn't exist yet (coming soon).
warning [big.zip]:  1073741824 extra bytes at beginning or within zipfile
  (attempting to process anyway)
file #1:  bad zipfile offset (local header sig):  1073741828
  (attempting to re-compensate)
  inflating: ...
Related Question