Unzip multi-part archives in Linux

Although in Linux you can easily create multi-part zip files, unzipping them can be problematic.

By using the -s argument in the zip command you can specify the split size and create split archives. The following example creates split archives with each part not larger than 1GB:

zip -9rys 1g myzipfile.zip /dir1/subdir2

The result could be something like:

myzipfile.z01
myzipfile.z02
myzipfile.zip

Where the file with the .zip extension will be created last and goes AFTER the last .z?? file.

If you were to unzip these files, you may run into the following scenario:

warning [myzipfile.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):  70
file #3:  bad zipfile offset (local header sig):  146
. . .

In order to work around this, you have a few options.

The first one is to concatenate all the files together like this:

cat myzipfile.z01 myzipfile.z02 myzipfile.zip > mybigzipfile.zip

After which you then unzip the new file called mybigzipfile.zip.

The second option is to use the zip repair option with the -F or –fix argument. Example:

zip --fix myzipfile.zip --output mybigzipfile.zip

And then you unzip the mybigzipfile.zip file.

If the -F or –fix option doesn’t work, try again with the -FF or –fixfix argument.

2 thoughts on “Unzip multi-part archives in Linux

  1. The second option worked to fix the problem. Just wondering, do you know why the problem arises? Thanks for the help!

    • I am guessing that the multi-part support is not fully implemented in this version of zip. At least that is what the error message seems to suggest.

Leave a Reply

Your email address will not be published. Required fields are marked *

*