0

I need weekly to upload bunch of pdf file to grading platform, in the form of zip, but the website has limit of 250Mb per zip file, and it takes me too much time to split the zip I have into smaller zip files.

What is the simplest way to split a zip into chunks with max size?

A way that would work on other unix-like platform (like my mac at work) will be grate.

I'm looking an existing command that will do it, or some simple python (or node, or any other simple to use languages) module that will help we write a small script that does it.

0

You need zipsplit which is part of the zip package:

zipsplit -n $(( 250 * 1024 * 1024 )) your_zipfile.zip

It splits an existing zipfile into smaller chunks. The size of each chunk can be supplied via the -n switch. It defaults to 360000 because years ago floppy disks had a capacity of 360 kB.

Another option would be to create the chunks in the first place while zipping (see zip, especially the -s switch) and thus avoiding the separate zipsplit step:

zip -s 250m new-zipfile file1 file2 file3...

Unfortunately unzip new-zipfile.zip cannot handle the chunks created via zip -s so you have to join them on the target side before unzipping:

zip --fix new-zipfile --out joined-zipfile
unzip joined-zipfile
  • the files created will be real zip file of chunks (means that later on I will need to put them together) of the original one? If my original file contains f1.pdf (25MB) ,f2.pdf (20MB) and f3.pdf (8MB) and the limit is 50MB per zip file I want the output to be two zip files, one with f1.pdf and f2.pdf and one with f3.pdf. – Barak Ohana Jan 4 at 13:45
  • @BarakOhana zipsplit will create a number of stand-alone zipfiles each of which can be unzipped on its own (no joining needed). zip -s on the other hand creates a number of files that must be joined via zip --fix because unzip cannot currently handle these files. I'd go with zipsplit in your case. – PerlDuck Jan 4 at 14:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.