Linux: How to zip files in parts

Image for post
Image for post
Photo by Tomas Sobek on Unsplash

There are many times you need to zip a file to smaller parts, especially if you want to sent them with mail which might be an attachment limit

Linux zip command can take the-r and the -s parameters

  • r: means recursive.

Example:

$ zip -r -s 45m out.zip ./in

In this case zip will recursivelly compress all files in ./in directory with the maximum zip part being 45MB.

The generated files will have the following pattern

-rw-rw-r-- 1 kpatronas kpatronas 37M Ιουλ  9 12:14 out.zip
-rw-rw-r-- 1 kpatronas kpatronas 45M Ιουλ 9 12:14 out.z01

Written by

DevOps engineer, loves Linux, Python, cats and Amiga computers

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store