7zip / 7za command-line parameters for highest compression
Posted by jpluimers on 2019/03/14
On my systems these so far give the best compression results with 7zip and p7zip 16.02:
-t7z -m0=lzma2:d=1024m -mx=9 -aoa -mfb=64 -md=32m -ms=on
Note the -d=1024m
is mentioned on some sites, but is gone around version 16.
Via:
- [WayBack]: batch file – 7zip Ultra LZMA2 compression – Stack Overflow
- m (Set compression Method) switch: Specifies the compression method., The format for this switch depends on the archive type.
If you want to delete the files after archiving, then use the -sdel
switch: -sdel (Delete files after including to archive) switch
If -sdel switch is specified, 7-Zip deletes files after including to archive. So it works like moving files to archive., moves txt files from disk’s directory to a.7z archive.
–jeroen
Peter Wright said
Just a small warning about what is otherwise an excellent product. I refer to an unfixed bug https://sourceforge.net/p/sevenzip/bugs/1519 where an archive contains an 8.3 filename and a long filename. If the long filename is extracted first, default OS behaviour is to generate a short filename along with the long filename. If the short filename generated by the OS matches the 8.3 filename recorded in the archive (remembering that it’s a different file entirely) then 7zip will prompt for some user-interaction (overwrite,skip, generate new file name, etc.)
This issue was raised nearly 4 years ago, is very easy to fix (simple extract the 8.3s first, then the long filenames) but the response is very negative and unprofessional (“I think this matter should be handled by the OS” and “The fact is that filenames like demons~1.txt do not usually appear in archives. In my opinion, this behavior with short names needs not to be fixed, at least in 7-Zip”.