鉴于 img.zip 包含同一张照片的 13 个副本,我需要将 zip 文件拆分为多个部分,并能够从生成的部分中将其解压缩。为了将其分割为 100KB 的部分,我这样做:
zip img.zip --out img-pt -s 100k
导致
100K img-pt.z01
100K img-pt.z02
100K img-pt.z03
40K img-pt.zip
我可以在 macOS 上使用 keka 从生成的部分中提取内容。但是,我无法使用
unzip
解压缩,这是我尝试得到的结果:
>>> unzip img-pt.zip
Archive: img-pt.zip
warning [img-pt.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).
file #1: bad zipfile offset (local header sig): 4
file #2: bad zipfile offset (local header sig): 66
file #3: bad zipfile offset (local header sig): 26614
file #4: bad zipfile offset (lseek): 49152
file #5: bad zipfile offset (lseek): 73728
file #6: bad zipfile offset (local header sig): 3858
file #7: bad zipfile offset (local header sig): 30406
file #8: bad zipfile offset (lseek): 49152
file #9: bad zipfile offset (lseek): 81920
file #10: bad zipfile offset (local header sig): 7650
file #11: bad zipfile offset (local header sig): 34198
file #12: bad zipfile offset (lseek): 57344
file #13: bad zipfile offset (lseek): 81920
extracting: img/002.jpeg
还有
>>> cat img-pt.z01 img-pt.z02 img-pt.z03 img-pt.zip > img.zip
>>> unzip img.zip
Archive: img.zip
warning [img.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 [img.zip]: 307200 extra bytes at beginning or within zipfile
(attempting to process anyway)
file #1: bad zipfile offset (local header sig): 307204
(attempting to re-compensate)
creating: img/
extracting: img/001.jpeg
extracting: img/007.jpeg
extracting: img/011.jpeg
extracting: img/010.jpeg
file #6: bad zipfile offset (local header sig): 3858
(attempting to re-compensate)
file #6: bad zipfile offset (local header sig): 3858
file #7: bad zipfile offset (local header sig): 337606
file #8: bad zipfile offset (lseek): 360448
file #9: bad zipfile offset (lseek): 385024
file #10: bad zipfile offset (local header sig): 314850
file #11: bad zipfile offset (local header sig): 341398
file #12: bad zipfile offset (lseek): 360448
file #13: bad zipfile offset (lseek): 393216
extracting: img/002.jpeg
如何在终端中提取文件而不出现错误?并且最好不要连接各个部分
将所有文件
.z*
和.zip
放入同一目录并使用以下命令:
zip -s- img-pt.zip -O combined.zip
unzip combined.zip
如果您正在处理大文件,您可以使用 7zip 直接提取,而无需合并各个部分:
7z x img-pt.zip
这将立即开始提取。