从命令行解压缩多部分 Zip

从命令行解压缩多部分 Zip

在此先感谢大家的帮助。我正在尝试从 OSX 10.8.5 中的命令行解压缩多部分 zip 文件。

我使用以下方式创建了 zipzip -s 800m foo.zip foo.mov

该文件foo.mov大小为 2.7GB。因此我有以下文件:foo.zip, foo.z01, foo.z02, foo.z03

我尝试使用zip -s 0 foo.zip -O foo_unsplit.zip,但 foo_unsplit.zip 只有 1.6GB,与 unzip 一起使用时出现以下错误。

error:  invalid compressed data to inflate

我也尝试使用cat Heritage.zip Heritage.z01 Heritage.z02 Heritage.z03 > Heritage_unsplit.zip但解压结果文件给出以下结果:

unzip Heritage_unsplit.zip 
Archive:  Heritage_unsplit.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of Heritage_unsplit.zip or
        Heritage_unsplit.zip.zip, and cannot find Heritage_unsplit.zip.ZIP, period.

有人知道在命令行中解压多部分文件的方法吗?我尝试过任何错误吗?

答案1

我假设不同 MacOS 版本的情况有所不同 - 我目前正在运行高脊山脉 并且unzip仍然无法正确支持多部分 - 但我以cat相反的顺序做了同样的技巧并且成功了。

cat Heritage.z03 Heritage.z02 Heritage.z01 Heritage.zip > Heritage_unsplit.zip 然后unzip它就开始起作用了。

我遇到了一些类似下面的错误,但文件是二进制相等的:

> unzip big.zip
Archive:  big.zip
warning [big.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).
warning [big.zip]:  1073741824 extra bytes at beginning or within zipfile
  (attempting to process anyway)
file #1:  bad zipfile offset (local header sig):  1073741828
  (attempting to re-compensate)
  inflating: ...

答案2

您错过了文件的顺序cat,顺序应该是:

cat foo.z01, foo.z02, foo.z03 foo.zip > unsplited_foo.zip

使用后unzip

unzip unsplited_foo.zip

相关内容