I'm trying to zip the content of a folder that contains 4 big files, very, very similar. So I expect the size to be reduced.
Here's the command I'm using on linux/fedora:
zip -9 myarchive.zip -r myfolder -P mypassword
I get the response:
adding: myfolder/ (stored 0%)
adding: myfolder/Program1.exe (deflated 0%)
adding: myfolder/Program2.exe (deflated 0%)
adding: myfolder/Program3.exe (deflated 0%)
adding: myfolder/Program4.exe (deflated 0%)
Then I get the archive, which is approx the same size as my original folder.
It seems that no compression is occurring at all. Why?
Again, if you create Zip files and see files that cannot be significantly compressed, it is probably because they already contain compressed data or they are encrypted. If you would like to share a file or some files that do not compress well, you might: Email photos by zipping and resizing them.
So, to answer to your question : the stored 0% is fine ! The file has been added but not compressed.
zip is just a container-format, which can hold many possible types of compressed and uncompressed entries. Often files are deflated , which means, they are compressed. Others are simply stored , which means they are uncompressed.
The Zip compression level used in current OpenEXR is level 6, marked with the triangle shape point on the graph. Compression ratio is not affected much by the level settings - fastest level (1) compresses data 2.344x; slowest (9) compresses at 2.473x. Levels don't affect decompression performance much.
Unlike tar
+ gzip
, zip
uses a new compression table for each file, so even if the four files were identical, it would try to compress each individually.
Technically, tar
also sees each file but it strings them together into one long input for gzip
, so the compression step works on one huge input which is why tar
+ gzip
usually yields a smaller result than zip
.
The question is why your exe
files can't be compressed. exe
files usually contains large amounts of easily compressible data, so they should shrink ("deflate") by at least 30%. Maybe the files are encrypted or obfuscated; these processes make the result hard to compress.
Deflated 0% means that it did try to compress, but got effectively no compression. As noted, the zip format cannot take advantage of similarity between different entries. tar + gzip can, but even then only if the similarities end up less than 32K bytes away from each other. Other formats can exploit longer distance similarities, such as xz.
It is normal for uncompressed executables to compress by 30% to 50%, which means that your executables are either a) compressed by something like UPX, b) they are self-extracting compressed data, where the decompressor is stored ahead of the compressed data, c) they are very short executables with a lot of compressed data, or d) they are mostly encrypted.
Aaron is correct. According to Wikipedia
, the ZIP
format compresses before it archives, so similarities among different files doesn't help compression.
Are you really trying to compress .exe
files? Somehow I doubt that's your actual file type.
See http://en.wikipedia.org/wiki/ZIP_(file_format)#Advantages_and_disadvantages .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With