如何将.zip文件拆分为多个段?


27

我已经安装了所有命令行实用程序,并且需要在Terminal中将现有.zip(或)新文件拆分为(50MB).zip段。

即文件夹X = 900MB>创建自解压.zip存档> 将存档拆分.zip为50MB的段(即Folder.X.001.zip

根据手册页,以下是命令:

Copyright (c) 1990-2008 Info-ZIP - Type 'zip "-L"' for software license.
Zip 3.0 (July 5th 2008). Usage:
zip [-options] [-b path] [-t mmddyyyy] [-n suffixes] [zipfile list] [-xi list]
  The default action is to add or replace zipfile entries from list, which
  can include the special name - to compress standard input.
  If zipfile and list are omitted, zip compresses stdin to stdout.
  -f   freshen: only changed files  -u   update: only changed or new files
  -d   delete entries in zipfile    -m   move into zipfile (delete OS files)
  -r   recurse into directories     -j   junk (don't record) directory names
  -0   store only                   -l   convert LF to CR LF (-ll CR LF to LF)
  -1   compress faster              -9   compress better
  -q   quiet operation              -v   verbose operation/print version info
  -c   add one-line comments        -z   add zipfile comment
  -@   read names from stdin        -o   make zipfile as old as latest entry
  -x   exclude the following names  -i   include only the following names
  -F   fix zipfile (-FF try harder) -D   do not add directory entries
  -A   adjust self-extracting exe   -J   junk zipfile prefix (unzipsfx)
  -T   test zipfile integrity       -X   eXclude eXtra file attributes
  -y   store symbolic links as the link instead of the referenced file
  -e   encrypt                      -n   don't compress these suffixes
  -h2  show more help

-h2我得到:

Splits (archives created as a set of split files):
  -s ssize  create split archive with splits of size ssize, where ssize nm
              n number and m multiplier (kmgt, default m), 100k -> 100 kB
  -sp       pause after each split closed to allow changing disks
      WARNING:  Archives created with -sp use data descriptors and should
                work with most unzips but may not work with some
  -sb       ring bell when pause
  -sv       be verbose about creating splits
      Split archives CANNOT be updated, but see --out and Copy Mode below

.....

Using --out (output to new archive):
  --out oa  output to new archive oa
  Instead of updating input archive, create new output archive oa.
  Result is same as without --out but in new archive.  Input archive
  unchanged.
      WARNING:  --out ALWAYS overwrites any existing output file
  For example, to create new_archive like old_archive but add newfile1
  and newfile2:
    zip old_archive newfile1 newfile2 --out new_archive
  Cannot update split archive, so use --out to out new archive:
    zip in_split_archive newfile1 newfile2 --out out_split_archive
  If input is split, output will default to same split size
  Use -s=0 or -s- to turn off splitting to convert split to single file:
    zip in_split_archive -s 0 --out out_single_file_archive
      WARNING:  If overwriting old split archive but need less splits,
                old splits not overwritten are not needed but remain

Answers:


39

您有existing.zip但想要将其拆分为50M大小的部分。

zip existing.zip --out new.zip -s 50m

将创建

new.zip
new.z01
new.z02
new.z03
....

要提取它们,您应该首先将文件收集在一起并运行zip -F new.zip --out existing.zipzip -s0 new.zip --out existing.zip来重新创建文件existing.zip。然后,您可以简单地进行操作unzip existing.zip


您希望unzip new.zip可以使用,但是不幸的是它没有实现

warning [new.zip]:  zipfile claims to be last disk of a multi-part archive;
  attempting to process anyway, assuming all parts have been concatenated
  together in order.  Expect "errors" and warnings...true multi-part support
  doesn't exist yet (coming soon).

在我的测试中,按照建议的方式将各个部分连接在一起(例如,使用cat并运行解压缩)无法提取我的所有文件


1
我可以使用在虚拟机中Windows上运行的7-Zip从拆分的.zip文件(在Mac OS X 10.11命令行上使用Zip 3.0创建)中提取数据。我只是将7-Zip指向共享文件夹中的new.zip文件,它的工作原理就像一个魅力。
User5910

3
虽然不能简单地使用unzip new.zip,但是您只需new.zip在macOS中单击即可。谢谢!
Dan Rosenstark '18

4

这对我有效:

zip -s 50m new.zip big.iso

对于50MG零件

new.zip
new.z01
new.z02
...

以此创建3G块(适用于将大文件放在FAT32磁盘上)

zip -s 3g new.zip big.iso

双击new.zip文件时,新的Mac OS会提取这些文件。


2
在mac os 10.13.6 High Sierra上双击zip文件并没有为我解压缩原始存档。我必须使用itunes.apple.com/us/app/the-unarchiver/id425424353上的“
Unarchiver

1
我在Windows上分割了7zip创建的zip文件,但最终得到了不同的文件命名方案。Unarchiver也能够提取该信息!
Max

0

我还必须使用Unarchiver提取生成的多部分ZIP文件,但是奇怪的是,它重新创建了zip文件的原始路径。例如,我最初在这里创建档案:

/卷/外部HD /测试文件夹/my-multipart-archive-parts.zip

并将存档的所有部分复制到此处:

〜/桌面/测试文件夹/

当我使用Unarchiver提取文件时,它创建了以下代码:

〜/桌面/测试文件夹/卷/外部HD /测试文件夹/my-multipart-archive.zip

很奇怪...

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.