Create Multipart Zip Files In Linux

Need to transfer a really large file but are worried that it will fail before completing?

Create a multi-part file using the split command, then join it on the remote server after it transfers. Example: Start with a zipped file (somefile.zip), then run…

split -b 10m somefile.zip someprefix-

That will take somefile.zip, chop it into 10MB pieces and name them “someprefix-aa, someprefix-ab, etc.” Run “man split” for all the options:

split -b number[ k|m ] [-a suffixlength] [filename [prefix] ]

If your file will be split into more than 52 pieces, you’ll need to change the number of suffix length. The default is 2 (a-z, twice).

After transferring the pieces to the remote server, re-assemble them with cat…

cat someprefix-aa someprefix-ab ... > somefile.zip

2 Comments

  1. Pretty good post. I just found your blog and wanted to say
    that I’ve really enjoyed browsing your posts. Any way
    I’ll be subscribing to your feed and I hope you write again soon!

    Reply
  2. Well, very old post but do you know if using this method i can decompress those files under Windows?

    Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>