Wednesday 25 October 2017

How to split a zip file into chunks on Linux

Sometimes I need to upload log files to a vendor. For some reason large vendors like to add file size limits to their uploads. In a large environment this makes it hard to upload logs.

A way around this is to zip a folder and split it into smaller chunks of a pre defined size.

Lets say a vendor imposes a maximum file upload size of 85MB. we could use the zip command and tell it to create a new file every 85MB with the following:

zip -r -s 85m new-zip-name.zip /tmp/logfiles/*

new-zip-name.zip can be anything you want as long as it ends in .zip. The resulting files will have a number appended to them. 

/tmp/logfiles/* is the directory you want to zip up.

No comments:

Post a Comment