Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to find a utility or approach out there that will allow me to compress an entire directory into chunks. I know it's easy to specify, for example, that the archive files created should be exactly X size or smaller, but the archive utilities usually make it so you need all the archive files to open the archive, and that's what I'm trying to avoid. I need to be able to specify a maximum size of an archive file and it adds files into it until it's going to run out of space on the next file so it starts a new archive file. That way the archive files are technically independent of each other.

I'm sorry, it's hard for me to put this into words precisely. Please comment if I'm not being specific enough.

share|improve this question

Sometimes I am in the same situation, many big files have to be compressed into a few archives. As I also did not found a tool that fit my needs, I take a different approach.

All small (e.g. max 100MB) files get into one archive, the big (e.g. 500MB and bigger) files will be compressed into a single archive each. So I just pipe the contents of the directory into a textfile and convert that into a simple batchfile:


zip -9 file1.dat
zip -9 file2.csv
zip -9 file3.mdf

Its a bit handcrafting, but works for me, hope that helps a bit. ;-)

share|improve this answer

If you are using GNU tar I believe you can specify -L (tape length, in kilobytes) -- I believe the resulting "tapes" can be untar'd independently.

Not sure how the "change tape" functionality behaves with files (or compression) though, so experiment first :-)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.