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

48 terminal macos

我安装了所有命令行实用程序,需要在终端中将现有.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
Run Code Online (Sandbox Code Playgroud)

-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
Run Code Online (Sandbox Code Playgroud)

.....

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
Run Code Online (Sandbox Code Playgroud)

Dan*_*eck 67

你有existing.zip但想把它分成不同50M大小的部分。

zip existing.zip --out new.zip -s 50m
Run Code Online (Sandbox Code Playgroud)

会创造

new.zip
new.z01
new.z02
new.z03
....
Run Code Online (Sandbox Code Playgroud)

要提取它们,您应该首先将文件收集在一起并运行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).
Run Code Online (Sandbox Code Playgroud)

在我的测试中,按照它的建议连接各部分,即使用 cat 并运行解压缩,未能提取我的所有文件

  • `cat new.z*[0..9]* new.zip >existing.zip` 然后 `unzipexecution.zip` 应该可以工作。 (4认同)
  • 虽然你不能简单地使用 `unzip new.zip`,你可以在 macOS 中点击 `new.zip` 就可以了。谢谢! (3认同)
  • 我能够使用在虚拟机中的 Windows 上运行的 7-Zip 从拆分的 .zip 文件(在 Mac OS X 10.11 命令行上使用 Zip 3.0 创建)中提取我的数据。我只是将 7-Zip 指向共享文件夹中的 _new.zip_ 文件,它就像一个魅力。 (2认同)

小智 12

这对我有用:

zip -s 50m new.zip big.iso
Run Code Online (Sandbox Code Playgroud)

对于 50MG 零件

new.zip
new.z01
new.z02
...
Run Code Online (Sandbox Code Playgroud)

用这个创建 3G 块(适合将大文件放在 FAT32 磁盘上)

zip -s 3g new.zip big.iso
Run Code Online (Sandbox Code Playgroud)

新的 Mac 操作系统在双击 new.zip 文件时提取这些文件

  • 在 mac os 10.13.6 High Sierra 上双击 zip 文件并没有为我解压缩原始档案。我不得不使用来自 https://itunes.apple.com/us/app/the-unarchiver/id425424353 的“The unarchiver”应用程序 (2认同)