【问题标题】:How to unzip multi-part zip file in terminal?如何在终端中解压多部分 zip 文件?
【发布时间】:2023-01-09 00:11:57
【问题描述】:

给定包含同一张照片的 13 个副本的 img.zip,我需要将 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   

如何在没有错误的情况下提取终端中的文件?并且最好不要连接部件

【问题讨论】:

  • 该程序告诉你期待错误和警告,因为你正在做一些它不完全支持的事情......
  • 然而它支持拆分成多个部分,我觉得这很奇怪
  • the manpage的BUGS部分第一段
  • 看起来我需要在连接的部分上使用zip -F,直到他们修复下一个版本中的任何错误。

标签: bash terminal zip zsh unzip


【解决方案1】:

将所有文件.z*.zip放入同一目录并使用以下命令:

zip -s- img-pt.zip -O combined.zip
unzip combined.zip

【讨论】:

    猜你喜欢
    • 2021-12-29
    • 2012-05-31
    • 1970-01-01
    • 1970-01-01
    • 2013-09-06
    • 1970-01-01
    • 1970-01-01
    • 2023-03-04
    • 1970-01-01
    相关资源
    最近更新 更多