我使用如下命令在我的计算机(Mac OS X)上创建了一堆zip文件:
zip -r bigdirectory.zip bigdirectory
然后,我将这些zip文件保存在某处并删除了原始目录.
现在,当我尝试解压缩zip文件时,我遇到了这样的错误:
$ unzip -l bigdirectory.zip Archive: bigdirectory.zip warning [bigdirectory.zip]: 5162376229 extra bytes at beginning or within zipfile (attempting to process anyway) error [bigdirectory.zip]: start of central directory not found; zipfile corrupt. (please check that you have transferred or created the zipfile in the appropriate BINARY mode and that you have compiled UnZip properly)
我发现这可能是因为zip无法处理超过一定大小的文件,也许是4演出.至少我在某处读过.
但为什么zip命令会让我创建这些文件?有问题的zip文件是9457464293字节,它让我更像这样,绝对没有错误.
很明显它可以创建这些文件.
我真的希望我的档案不会丢失.我已经吸取了教训,将来我会在删除原始文件之前检查我的档案,并且我可能还会使用其他文件格式,如tar/gzip.
但就目前而言,我该怎么办?我真的需要我的文件.
有些人建议我的unzip
工具不支持足够大的文件(这很奇怪,因为我使用了内置的OS X zip
和unzip
).无论如何,我安装了一个新unzip
的homebrew
,并且看,我现在得到一个不同的错误:
$ unzip -t bigdirectory.zip testing: bigdirectory/1.JPG OK testing: bigdirectory/2.JPG OK testing: bigdiretoryy/3.JPG OK testing: bigdirectory/4.JPG OK : : file #289: bad zipfile offset (local header sig): 4294967295 (attempting to re-compensate) file #289: bad zipfile offset (local header sig): 4294967295 file #290: bad zipfile offset (local header sig): 9457343448 file #291: bad zipfile offset (local header sig): 9457343448 file #292: bad zipfile offset (local header sig): 9457343448 file #293: bad zipfile offset (local header sig): 9457343448 : :
这真的令人担忧,因为我需要这些文件.使用系统zip
工具创建此zip文件时肯定没有错误.事实上,我同时制作了其中的几个,现在他们都表现出同样的问题.
如果文件确实已损坏,我该如何解决?
或者,如果它没有损坏,我该如何提取它?
在6以下解压缩看似失败,使用
jar -xf <zipfile>
如果您已经安装了Java,或者在关闭文件之前还有另一个解压缩.
请参阅:https://serverfault.com/questions/235139/how-to-unzip-files-bigger-than-4gb
7z x
我unzip %x
在Linux上遇到了与.zip
4GB以上文件相同的问题,并且出现了only DEFLATED entries can have EXT descriptor
错误.
该命令7z x
解决了我的所有问题.
但要小心,该命令7z x
将使用以当前目录为根的路径提取所有文件.该选项-o
允许指定输出目录.
在执行硬盘格式之前,我在备份12GB目录时遇到了类似的问题.有趣的是,我使用了与你相同的命令.
我四处阅读并找到了建议:
zip -F
和
zip -FF
尝试修复该文件.
不幸的是这些没有用,我仍然收到错误.
在查看了一些之后,我发现了ditto命令,它完全符合我的原始(未触摸)zip文件:
ditto -x -k original-file.zip dst-directory -x to extract an archive -k Specifies it to be a PKZip archive instead of the default CPIO
使用此命令后,我成功提取了所有文件.