theCrow
theCrow

Reputation: 346

How to find the compression level of a zip file?

I would like to know how to find the compression level of a zip file. Zip files made by 7z and winzip have different ratings for levels, so i would like to map few of them to their corresponding level in the other tool. Store level or level 0 for all should be the same, but how do we check? or to be specific, How can we find the compression level of a zip file from file data, or By comparing with other zip files, for which we know the level of.

Refereed compression algo - DEFALTE

Upvotes: 7

Views: 8371

Answers (2)

Sasha Golikov
Sasha Golikov

Reputation: 738

You could use unzip -lv command in Linux and Solaris.

$ unzip -lv achive.zip
Archive:  achive.zip
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
    6461  Defl:N     1490  77% 10-18-2021 20:02 c6519bca  file1.txt
   24834  Defl:N     3148  87% 10-18-2021 20:01 f8f0bfb3  file2.txt
   24330  Defl:N     3139  87% 10-18-2021 20:00 4c89174d  file3.txt
  123601  Defl:N    14394  88% 10-18-2021 20:00 421be572  file4.txt
  108173  Defl:N     9409  91% 10-18-2021 20:01 40eebe7a  file5.txt
  106972  Defl:N     9014  92% 10-18-2021 20:02 469d0932  file6.txt
--------          -------  ---                            -------
  394371            40594  90%                            6 files

Windows has not build-in unzip.exe, you need to install it.

Upvotes: 2

Mark Adler
Mark Adler

Reputation: 112189

The only way is to recompress the zip file with different levels until you find the one that matches the lengths. You could just recompress one of the entries to find the level, on the assumption that the entire zip file used the same level.

Even that only works if you know the tool, and the version of the tool that was used. E.g. 7z, WinZip, Info-ZIP.

Upvotes: 9

Related Questions