Linux zipsplit command

Updated: 11/06/2021 by Computer Hope
zipsplit command

On Unix-like operating systems, the zipsplit command splits a single zip archive into a set of smaller zipfiles.

This page covers the Linux version of zipsplit.

Description

zipsplit is a very simple program which will split an archive into smaller, sequentially-numbered zipfiles. This command can be useful, for instance, if you need to break an archive into smaller archives that fits onto removable media of limited capacity.

zipsplit does not break the individual files in your archive into smaller pieces; therefore, the minimum size of the split zipfiles is the size of the largest file inside the original archive.

Splitting an archive

Let's say you have a zipfile named archive.zip that is about 50 megabytes in size, and you want to split it into pieces that are no larger than 1 megabyte. You could use this command:

zipsplit -n 1048576 archive.zip

...which tells zipsplit to create a sequence of zipfiles, each no larger than 1048576 bytes (one megabyte), which collectively contain the same files as archive.zip. The output of this command looks something like:

66 zip files will be made (70% efficiency)
creating: archive01.zip
creating: archive02.zip
creating: archive03.zip
...
creating: archive66.zip

As you can see, the result here was 66 new files, archive01.zip through archive66.zip, which together contain the same files as archive.zip.

archive.zip is unchanged by this process.

Syntax

zipsplit [-t] [-i] [-p] [-s] [-n size] [-r room] [-b path] [-h] [-v] 
         [-L] zipfile

Options

-t Report how many files it takes to perform the split, but don't actually split anything.
-i Create a zip index named zipsplit.idx, and include its size in the first zip file.
-n size Create zipfiles no larger than size bytes. For the split to be successful, size must be larger than the largest file in the original zipfile. Default is 35978 bytes.
-r room Make the first split file smaller by room bytes. This option can be useful if you intend to store the split zipfiles on removable disks, and you need extra space on the first disk for other software, such as an executable file to decompress the archives. The default value of room is zero.
-b path Output zip files into the path path.
-p Pause between each zip file that is output.
-s Perform a sequential split even if it requires more zip files. In other words, make sure that the order of files in the split archives exactly matches the order of files as they appear in the original archive; do not "shuffle them around" when splitting them up.
-h Display a help message, and exit.
-v Display version information, and exit.
-L Display software licensing information, and exit.

Limitations

zipsplit does not support splitting archives that are larger than 2 gigabytes.

zipsplit offers little control over how it decides to split up your archive. If one of the files inside your archive is large, you may not be able to split the archive at all, because zipsplit cannot span a single archived file across multiple zipfiles.

The default maximum size of a split file is approximately 36 kilobytes, which by modern standards is small. If you want or need to create splits larger than 36 Kb, you must specify a different maximum size using the -n option.

There is no convenient way to re-assemble a set of split zip archives into a single unified archive. Concatenating them manually and then "fixing" the concatenated file with zip's -FF option is possible, however. For example, if your split files are named archive01.zip, archive02.zip, etc. you could concatenate them into a new file, whole.zip, with the command:

cat archive*.zip > whole.zip

...and then "fix" whole.zip (re-build its index), using the command:

zip -FF whole.zip --out fixed.zip

...which would leave you with a re-assembled archive named fixed.zip.

Examples

zipsplit -n 2097152 /home/user/myarchive.zip

Split the archive /home/user/myarchive.zip into multiple smaller archives, each of that is no larger than 2097152 bytes (2 megabytes). The split files will be written into the current directory.

zipsplit -p -n 2097152 /home/user/myarchive.zip

Same as the above command, but pause between the creation of each split file. This command can be useful on much older systems if the destination of your split files is a floppy disk drive, as it gives you the option to insert a new floppy disk between each split.

zipsplit -b /archive -n 2097152 myarchive.zip

Split myarchive.zip into zipfiles no larger than 2 megabytes, and write the split zipfiles into the directory /archive.

unzip — List, test and extract compressed files in a zip archive.
zip — A compression and archiving utility.
zipcloak — Encrypt files within an existing zip archive.
zipnote — View, add, or modify a zip file's comments.