How to unzip a multipart (spanned) ZIP on Linux?

  • I need to upload a 400mb file to my web server, but I'm limited to 200mb uploads. My host suggested I use a spanned archive, which I've never done on Linux.

    I created a test in its own folder, zipping up a PDF into test.zip.001, .002, and .003. How do I go about unzipping it? Do I need to join them first?

    Please note that I'd be just as happy using 7z as I am using ZIP formats. If this makes any difference to the outcome.

    This may not be helpful on a web server with limited software installed, but I haven't seen this solution anywhere else and it's what I use: The java.util.zip API has dealt with all the ZIP parts I've thrown at it, even in the more general case of not having trailing parts or the last part being incomplete. I call it from Jython so it's in the form of a script, and here is the code: https://github.com/combatopera/unzipparts

  • fromnaboo

    fromnaboo Correct answer

    8 years ago

    You will need to join them first. You may use the common linux app, cat as in the example below:

    cat test.zip* > ~/test.zip
    

    This will concatenate all of your test.zip.001, test.zip.002, etc files into one larger, test.zip file. Once you have that single file, you may run unzip test.zip

    "How to create, split, join and extract zip archives in Linux" may help.

    OK, I like that... Progress... But I really am a Linux n00b here. I assume `x*` is the filename? And `~/hugefile` is a directory? What is the purpose of the tilde symbol? Sorry to ask what I suspect are very basic questions.

    when you split the files, you should use a prefix like x_ (ex: x_split1 , x_split2 , ... ; like the windows suffixes file.001, file.002...etc) the tilde represents your home directory. ~/hugefile is the same as /home/tim/hugefile. did you split your files ? what are the split files names?

    I think I see where the issue will come in, the Spanned archive was created in windows, using 7zip with a ZIP extension, so it auto creates as `TEST.zip.001`, `TEST.zip.002` and `TEST.zip.003` which means the split is very different. It's starting to look like it may be easier to thrown linux on a VMWare and create the files here, then at least i'm only dealing with 1 OS. Can you use the SPLIT command on ANY file type? i.e. images, audio movies etc?

    yes, the split command works on any file. install p7zip with apt-get install p7zip on debian or yum install p7zip on fedora, join the files with: cat TEST.zip.* > archive and extract them with.

    extract with $ 7za e archive

    Can `CAT` be used on files other than `txt` files?

    yes. you can join other files than txt files with cat.

    `7za x archive` is probably better if the archive contains a directory structure.

License under CC-BY-SA with attribution


Content dated before 6/26/2020 9:53 AM