Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I often have to gather log files and upload them to a central server (Owned by another company). The central server has a size limit of the file, so I am trying to create the smallest file possible that is still in the zip format.

What are the best setting to use when compressing a text file to a zip format when my only need is a small file size?

7zip Options

I've done the obvious and chosen ultra compression, and I have noticed that LZMA does a better job than deflate, but there are far too many other permutations of options for me to test them all.

share|improve this question
1  
Is splitting the the zip in to multiple files an option? –  JaredMcAteer May 10 '11 at 14:21
    
@Original, I don't think so. (Is that what the 'split to volumes' option is for?) I'd rather keep it simple and have just 1 file. If I really need, I can split the original file (which I have done in the past), but my goal is to keep it in one file. –  jjnguy May 10 '11 at 14:30
    
Oh, and I saw this question superuser.com/questions/178111/… But it really doesn't answer my question at all. –  jjnguy May 10 '11 at 14:32
    
I think the exact question you asked isn't answerable. Some text files compress better with different algorithms. Sometimes zip is better, sometimes gzip; sometimes, compression level makes a difference, and sometimes not. It all depends on the file. Therefore, instead of answering the precise question, I've addressed the motivating example, which deals with maximum allowed sizes. Even if you have the best possible algorithm, you're still limited by size, and a particularly large log might not be able to be compressed below that threshold, so you'll need splitting anyway. –  Rob Kennedy May 10 '11 at 14:42
2  
As soon as you pick anything but the Deflate format, it's not a "normal" .zip file anymore, but an "extended" zip file, pioneered by WinZip. They originally kept the extension as .zip, to much consternation (since most normal zip-handling tools can't deal with them), but most archivers use .zipx now to distinguish them from traditional .zip files. If you can use LZMA, switch to .7z and pick PPMd -- it should compress better (and faster!) for text files. –  afrazier May 20 '11 at 16:04

4 Answers 4

up vote 5 down vote accepted

I have found the following site which gives a brilliant short summary of the options in 7zip.

http://www.altap.cz/salam_en/help/7zip/dlgboxes_config.htm

share|improve this answer

If you can use .7z format rather than just .zip, I would simply use PPMD with the following options and leave everything else as set by the Compression Level:

  • Archive Format: 7z
  • Compression Method: PPMD
  • Compression Level: Ultra

I regularly compress server/text logs (60MB+) using these options and they usually come out at 1-2% of the original size.

share|improve this answer
    
For text such as log files, ppmd is definitely the way to go. However, the question mentioned that it needed to stay in the zip format, which may not work with PPMD. –  Brian Minton Dec 19 '13 at 16:31
    
Just tried zip with PPMD and Windows Explorer opens the contents up without complaint here on Windows 7 –  Umber Ferrule Dec 20 '13 at 16:44
    
I noticed that too. It opens the contents up just fine. However, when I actually tried to view one of the files inside the zip file, it failed. –  Brian Minton Dec 23 '13 at 16:58

From the command line, you can use the following ultra settings:

7z a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on archive.7z dir1

Which are:

-t7z   7z archive

-m0=lzma
       lzma method

-mx=9  level of compression = 9 (Ultra)

-mfb=64
       number of fast bytes for LZMA = 64
-md=32m
       dictionary size = 32 megabytes

-ms=on solid archive = on
share|improve this answer
    
Really like your answer. Thanks. –  Tek Jul 19 at 8:29

Set the "split to volume, bytes" field to the server's maximum allowed file size (in bytes, I think, although it looks like it accepts common abbreviations like "KB" and "MB"). If the zip file exceeds that size, 7-zip will split it into multiple files automatically, such as integration_serviceLog.zip.001, integration_serviceLog.zip.002, etc. (Way back when, PK Zip used this to span zip files across multiple floppy disks.) You'll need all the files to be present to unzip them. Use that instead of worrying about the absolute best compression settings to use for any particular set of files, because what's best for one file may be different for another file, and you don't want to have to go through this every time you need to copy logs.

share|improve this answer
1  
I'm worried about how the people on the other side will uncompress the files. I need it to be as simple as possible for them. Do you know if you can unzip the split volumes using the built-in windows zip, or gzip? –  jjnguy May 10 '11 at 14:40
    
Apparently, no, the built-in Windows zip-folder feature doesn't do spanned zip files. That's too bad, since it's been a standard feature of the format since before Windows 3. I'd be very surprised if gzip couldn't do it, though. WinZip definitely can. –  Rob Kennedy May 10 '11 at 14:47

Your Answer

 
discard

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

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