Reputation: 1
Given img.zip which contains 13 copies of the same photo, I need to split the zip file into parts and be able to unzip it from the generated parts. To split it to equal 100KB parts I do:
zip img.zip --out img-pt -s 100k
which results in
100K img-pt.z01
100K img-pt.z02
100K img-pt.z03
40K img-pt.zip
I am able to extract from the generated parts using keka on macOS. However, I am unable to unzip using unzip
, here's what I try and get:
>>> 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
also
>>> 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
How to extract the files in terminal without getting an error? And without concatenating the parts, preferably
Upvotes: 2
Views: 6172
Reputation: 471
If you're dealing with huge files, you can use 7zip instead to extract directly without having to combine the parts:
7z x img-pt.zip
That will start extracting right away.
Upvotes: -1
Reputation: 2586
Put all the files .z*
and .zip
into the same directory and use the following commands:
zip -s- img-pt.zip -O combined.zip
unzip combined.zip
Upvotes: 4