R's Workshop

Split Large Archive into Multiple Files

紀錄一下在 Linux 上要如何把壓縮檔(tar or zip)拆成數個小檔案.

Tar Archive

適用於所有與 tar 搭配的壓縮方式 (gzip, bzip2, xz, etc.)

Compress and Split

以 gzip 為例

The results splitted files would be named in the following series, “myarchive.tar.gz.partaa”, “myarchive.tar.gz.partab”, …

Merge and Decompress

Zip Archive

Compress and Split

# Each splitted archive has 5 MB in size
$ zip -r -s 5m myarchive.zip myfolder/

The results would be “myarchive.zip”, “myarchive.z01”, “myarchive.z02”, “myarchive.z03”, …

Merge and Decompress

$ zip -F myarchive.zip --out single-archive.zip
$ unzip single-archive.zip

Reference

Linux