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.
- Description
- Splitting an archive
- Syntax
- Limitations
- Examples
- Related commands
- Linux commands help
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
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 very 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 very 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.
Related commands
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.