69

How do I unzip a split zip file?

In Terminal, I wrote: unzip filename.zip and it did not unzip this file.

Terminal wrote:

$ unzip filename.zip
Archive:  filename.zip
warning [filename.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).
file #1:  bad zipfile offset (local header sig):  4
file #2:  bad zipfile offset (local header sig):  98
file #3:  bad zipfile offset (local header sig):  471
file #4:  bad zipfile offset (local header sig):  6635222

Double clicking of this file creating filename.zip.cpgz

What can I do?

4
  • 1
    So, are there any other parts of this file or do you only have this one part? If you only have one, are you trying to get the contents of this part only?
    – slhck
    Commented Dec 7, 2011 at 17:12
  • Have you tried other uncompression tools? I'd run uncompress and gunzip on the file and see if was processed with one of those.
    – Wilersh
    Commented Dec 7, 2011 at 20:25
  • It's no problem to unzip multiple archive using unarchiver.app but I'm looking for the terminal command to do this without of using any apps.
    – Kris
    Commented Dec 8, 2011 at 14:16
  • First I'd take it over to a Windows box and try 7Zip on it. If that doesn't work I'd try to find the rest of the zip file pieces and concatenate them together. Commented Jul 20, 2013 at 1:00

12 Answers 12

74

This was the straight forward and only solution that worked for me on OS X (taken from here).

1. To create a split zip archive (a series of files named zip, z01, z02...), run following command in Terminal:

zip -s 100m -x "*.DS_Store" -r split-foo.zip foo/

2. To extract a split zip archive (a series of files named zip, z01, z02...), run following command in Terminal:

First, combine the split archive to a single archive:

zip -s 0 split-foo.zip --out unsplit-foo.zip

Extract the single archive using unzip:

unzip unsplit-foo.zip
5
  • 32
    if you have splitted binaries, like file.zip.001, file.zip.002 ... you may just need to combine the files e.g. using cat command: cat file.zip.* > single.zip
    – Karl Adler
    Commented Apr 29, 2015 at 9:52
  • @abimelex your comment helped solve my exact scenario!
    – Daniel Apt
    Commented Jun 2, 2015 at 11:44
  • 1
    You're the man @abimelex !!!!! - I did have to use p7zip to extract them because of this error: need PK compat. v5.1 (can do v4.5)
    – bryan
    Commented May 18, 2017 at 15:06
  • I'm glad to help. Since the comment has a lot of up-votes I added it as answer too.
    – Karl Adler
    Commented May 19, 2017 at 8:16
  • 2
    zip -s 0 split-foo.zip --out unsplit-foo.zip doesn't make any sense as a split archive? How would you combine two files into one zip file?
    – gotnull
    Commented Mar 16, 2020 at 2:03
19

Just cat all zip files in sequence to a single file and use unzip command on that.

For example:

cat file.zip.001 > s.zip 
cat file.zip.002 >> s.zip
cat file.zip.003 >> s.zip

unzip s.zip 
3
  • 2
    didn't work for me as I got this error message warning [s.zip]: 1629602286 extra bytes at beginning or within zipfile
    – gota
    Commented Jan 16, 2020 at 12:20
  • @gota If that happens, use the top-rated answer: superuser.com/a/517758/565974
    – supergra
    Commented Mar 9, 2020 at 21:31
  • This doesn't work Commented Mar 23, 2021 at 21:30
17

additionally to this answer if you have split binaries, like file.zip.001, file.zip.002 ... you may just need to combine the files e.g. using cat command:

cat file.zip.* > single.zip
2
  • didn't work for me as I got this error message warning [s.zip]: 1629602286 extra bytes at beginning or within zipfile
    – gota
    Commented Jan 16, 2020 at 12:21
  • Try to verify the order using echo file.zip.*.
    – U. Windl
    Commented Jun 4, 2023 at 22:54
15

I hit this issue when trying to re-assemble a large directory downloaded from Google Drive.

Similar to this issue, if you are dealing with a set of zip files that do not include numbered file extensions (foo.z01, foo.z02, etc) and are simply multiple zip files that should be unarchived together into the same directory, the following worked for me:

unzip '*.zip' -d /path/to/unzip/destination
3
  • 1
    You are my saviour 🙏 This is exactly my case. Commented Jul 9, 2021 at 20:57
  • this is the only answer here that worked for me for the use case of downloaded files from Google Drive.
    – solstinger
    Commented Oct 14, 2023 at 22:09
  • This should be accepted answer! Commented Oct 26, 2023 at 11:42
4

Tested on a 10.8.5 Mac OS

  • Use Stuffit Expander free version
  • Just drag the last file (the one with .ZIP extension) in Stuffit
  • Wait for a while because it seeme Stuffit re-build first the complete file
  • See all your files unzipped
1
  • best and cleanest answer. Thanks Commented Jun 23, 2020 at 15:30
4

Just run this command on the bash prompt to concatenate the zips.

for i in `seq 1 5`; do cat file.zip.0$i>>uncut-version.zip; done

the above example has 5 parts.

Then unzip the file using your favourite method

unzip uncut-version.zip
3

In my case, within OS X 10.11.6, i had a multipart archive with extensions

.z01
.z02
... (etc)
.zip

Using

zip -s 0 in.zip --out out.zip

did get me a single zip. It did not extract with unzip, but did with 7zip, installed via MacPorts:

port install p7zip
7za x out.zip
1
  • 1
    7-zip worked for me on the original files. No need to zip first... Commented Mar 23, 2021 at 21:43
2

This was the most simple solution I could find:

find ./ -name "*.zip" -exec unzip {} \;
2

What worked for me is very simple: Open the .z01 file with the free Mac application The Unarchiver (available from the Mac App Store). It handles the extraction nicely.

0

Just Unzip all files using terminal unzip filename001.zip, filename002.zip that will automatically add files in one folder.

0

I used Keka. I had several files with extensions like .z01, .z02, .z03 and zip. I just extracted main zip with Keka and it did it's job perfectly.

0

in MacOS 10.13.6 High Sierra, working way is to:

cat filename.z01, filename.z02, filename.z03 filename.zip > unsplited_foo.zip

and after that use unzip:

unzip unsplited_foo.zip

NOTE: be careful order of files in cat is matter

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .