Looking at this question, I was curious whether a zip command could be used in a file-manager context menu to create multiple 20MB zip files (the level accepted by a gmail message). The answers to that question show that rar and 7z multi-files can be easily created, but I wondered if zip files can be as accessible.

A command like the one presented here should work. Both in a terminal and in Thunar custom actions I have seen the same result with this command:

zip my_archive.zip -r /path/to -s 20m

the version for Thunar is

zip my_archive.zip -r %f -s 20m

But the resulting archive (my_archive.z01, my_archive.z02, my_archive.z03..., my_archive.zip) cannot be opened.

Maybe that is expected, as I see here that those resulting files have to be "unsplit" before being "unzipped", with the command

 zip -s 0 my_archive.zip --out unsplit.zip

(I have to say I didn't expected the need for that, as usually other multi-file archives do not need to be re-joined before being extracted, and even an archive split with hjsplit gives multiple archive-volumes that can be directly extracted. But that's another matter.)

Only that the unsplit.zip file also gives an error upon extraction.

$ unzip unsplit.zip
Archive:  unsplit.zip
  inflating: home/cip/Desktop/R/Interviu/20170918.3gpp  
  error:  invalid compressed data to inflate

The archive cannot be extracted, but it can be opened (explored inside an archive manager) and it has an odd folder-inside-folder structure (reflecting the path where it was created initially; as in the inflating line above).

What is wrong?


1 Answer 1


This is a known issue in zip: it fails to recombine archives split on multiples of the internal buffer size (16KiB). For now you need to split on a different size... In your case, 20971519 (20MiB minus one byte) should work fine.

(I tried manually recombining a split archive, but zip -FF looks for the archive components and fails to fix the combined file.)

It turns out that File Roller supports split archives (without following the segmented archive format), so if your recipients all use that (or presumably, other archivers using libarchive), you can split your archive using split or a similar tool. For this to work, you need to generate files using split’s default suffixes, aa, ab etc:

split -b20m archive.zip split.z

Then File Roller will let you open split.zaa, and extract the whole archive transparently (as long as all the pieces are present obviously).

  • So, the multi-file archive is not ready to be extracted (needs a supplementary zip -s 0 command to create a 1-file archive) and this limitation cannot be avoided. Sending a such multi-archive to somebody that doesn't know this is pointless in this case.
    – user32012
    Commented Sep 19, 2017 at 11:38
  • 1
    Yes, 7z is a better solution for now (which is a shame really given how well multi-archive ZIP support works on other platforms). Commented Sep 19, 2017 at 11:41
  • I have found a multi-command for zip files that be added to the file-manager context menu and get with just one click a multi-volume archive ready to be extracted: zip -j my_archive.zip %F && split -b 20m my_archive.zip split.zip && rm my_archive.zip; more as an answer here.
    – user32012
    Commented Sep 19, 2017 at 13:18
  • That still leaves the same reconstruction problem though... If your archives contents are all files smaller than 20MB individually, you could look at zipsplit instead; that will produce split archives which are individually valid and thus easier to extract. Commented Sep 19, 2017 at 13:20
  • the split is done with split, not with zip, and doesn't seem affected by the 20MB problem; the command above works, I have tested it
    – user32012
    Commented Sep 19, 2017 at 13:22

You must log in to answer this question.