8

Is there a command to create multiple ZIP files based on file size? So that in a folder of 600 files, totalling 1 GB, the command will create 4 zips roughly equal to 250mb.

There's a similar command here. But it ZIPs files according to a file number limit.

I also don't want the resulting zip files to be connected with each other, so that I can open them individually and won't need to open all of them at the same time.

12

You're looking for zipsplit, it does pretty much what you're asking for. You'd create a ZIP file containing all your files, and then split it into files according to your requirements with zipsplit.

Something like:

zip -9 myfile.zip *
zipsplit -n 250000000 myfile.zip

would produce myfile1.zip, myfile2.zip etc., all independent of each other, and none larger than 250MB (in powers of ten). zipsplit will even try to organise the contents so that each resulting archive is as close as possible to the maximum size...

zipsplit is part of Info-ZIP's Zip, which is available as the zip package in all Linux distributions. The archives it produces are standard ZIP files; they can be opened without issue using other ZIP-compatible tools on other platforms.

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.