zip -s: Split an Archive Into Parts
zip -s splits the output into segments no larger than the size you specify.
When an upload target caps file size, splitting an archive into parts lets each segment fit under the limit. The parts must be kept together to extract.
What it does
zip -s <size> writes a split archive, breaking it into segments at the given size. The final segment keeps the .zip extension while earlier parts are named .z01, .z02, and so on. Sizes accept suffixes like k, m, and g.
Common usage
# split into 100 MB parts
zip -s 100m -r big.zip dataset
# turn an existing split archive back into a single file
zip -s 0 split.zip --out single.zipOptions
| Flag | What it does |
|---|---|
| -s <size> | Split into segments of at most this size (k/m/g suffix) |
| -s 0 | With --out, recombine a split archive into one |
| --out <file> | Write a copy to a new archive |
| -r | Recurse into directories |
In CI
All segments (.z01, .z02, ..., .zip) must be present together for extraction; uploading only the .zip part leaves an unextractable archive. If a consumer cannot handle split archives, recombine them first with zip -s 0 ... --out. Standard unzip can read split archives only when all parts are alongside each other.
Common errors in CI
"zip error: Interrupted ... Could not open ... for writing" can occur if the destination cannot hold a part. On extraction, "missing X bytes in zipfile" or a prompt for the next disk means a part (.z01, .z02) is absent; gather all segments. Some upload-artifact and storage flows reorder or drop the non-.zip parts, so package the split set as one bundle or recombine before upload.