How to open a split zip archive with more than 99 parts?

29 Views Asked by At

I think the problem is that when I concatenate the zip files before unzipping they are not in order because zip only uses one leading zero. For fewer than 100 files, the following works.

cat myzip.z* > cat_myzip.zip
unzip cat_myzip.zip

Is there a way to sort the files correctly for cat without renaming them, or otherwise unzip the split archive?

1

There are 1 best solutions below

0
amphetamachine On BEST ANSWER

For this answer I'm assuming the files are named myzip.z01, ..., myzip.z99, myzip.z100, etc.

Solution 0

If you have a halfway-decent unzipper program, you can just specify the first file and it'll automatically switch to the next part when needed:

7z x myzip.z00

Solution 1

If the split isn't something done in the standard way (You maybe used dd to split it instead of zipsplit), you can sort the files using sort -V ("version" sorting):

find . -type f -maxdepth 1 -name 'myzip.z[0-9]*' -print0 |
sort -V -z |
xargs -0 cat > myzip-combined.zip
unzip myzip-combined.zip

Solution 2

If you're using Bash, you can specify the filenames using a brace expansion with a leading 0 for 01-99, and no leading zero for 100-250:

cat myzip.z{{01..99},{100..250}} > myzip-combined.zip
unzip myzip-combined.zip