LinuxCommandLibrary

zipsplit

Split a large zip archive into smaller parts

TLDR

Split Zip archive into parts that are no larger than 36000 bytes (36 MB)

$ zipsplit [path/to/archive.zip]
copy

Use a given [n]umber of bytes as the part limit
$ zipsplit -n [size] [path/to/archive.zip]
copy

[p]ause between the creation of each part
$ zipsplit -p -n [size] [path/to/archive.zip]
copy

Output the smaller Zip archives into a given directory
$ zipsplit -b [path/to/output_directory] -n [size] [path/to/archive.zip]
copy

SYNOPSIS

zipsplit [options] zipfile

PARAMETERS

-s size
    Specifies the maximum size for each output segment. The size can be given in bytes, or with suffixes like 'k' (kilobytes), 'm' (megabytes), 'g' (gigabytes).

-n num_parts
    Divides the input ZIP file into a specified number of parts of roughly equal size. This option is often mutually exclusive with -s.

-o
    Overwrite existing output files without prompting.

-q
    Operate in quiet mode, suppressing most output messages.

-v
    Operate in verbose mode, providing more detailed information about the splitting process.

zipfile
    The path to the existing ZIP archive file to be split.

DESCRIPTION

The zipsplit command is a utility designed to divide a single, large ZIP archive file into multiple smaller ZIP-compatible segments. This functionality is particularly useful for scenarios where the original file size exceeds storage or transfer limits, such as transferring files via email attachments with size restrictions, or distributing data across multiple removable media like older floppy disks.

When executed, zipsplit reads the input ZIP file and generates a series of new files, typically named with a numeric suffix (e.g., archive.z01, archive.z02, and the final part as archive.zip). These segmented parts can then be individually handled and later re-joined or extracted by compatible ZIP utilities like unzip, provided all parts are present. It effectively manages the internal structure of the ZIP archive across the splits, ensuring data integrity for reconstruction.

CAVEATS

zipsplit is not a universally standard command installed by default on all Linux distributions. Its functionality is often integrated into the main zip utility (e.g., using zip -s option). Users might need to install the zip or unzip package which often includes this utility. The naming convention of the split files (e.g., .z01, .z02, .zip) is specific to the ZIP multi-part archive format. Rejoining these files typically requires a compatible zip or unzip utility that understands multi-part archives.

REJOINING SPLIT ARCHIVES

To re-assemble files split by zipsplit, ensure all parts (.z01, .z02, ..., .zip) are in the same directory. You can then use the unzip command on the final .zip part (e.g., unzip archive.zip), and it will automatically find and utilize the preceding parts. Alternatively, some versions of the zip command allow rejoining using options like zip -F (fix) or zip -s 0 (create single segment).

OUTPUT FILE NAMING

When splitting original.zip, zipsplit typically creates files named original.z01, original.z02, and so on, with the very last part usually being original.zip. This convention is crucial for the unzip utility to correctly identify and reassemble the archive.

HISTORY

The concept of splitting large files, particularly for distribution on removable media, dates back to the early days of personal computing, notably with floppy disk archives. zipsplit (or similar utilities/functionality within ZIP programs) emerged to handle the specific structure of ZIP archives for multi-disk sets, similar to PKZIP's multi-disk capabilities on MS-DOS. While less critical in the era of large storage and high-speed networks, it remains a useful niche tool for specific scenarios, especially when dealing with legacy systems or strict file size limitations.

SEE ALSO

zip(1), unzip(1), split(1), cat(1)

Copied to clipboard