如何通过cmd行列出带有文件大小和压缩率的zip内容


Answers:


108

您已经用zip和gzip标记了此标签,但这两者都有。这些都是Mac OS X支持的相当标准的Unix工具(据我所知):

压缩文件unzip -vl file.zip

例:

[23:02:22] ~/Download $ unzip -vl lightbox2.04.zip 
Archive:  lightbox2.04.zip
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
       0  Stored        0   0% 03-10-2008 00:57 00000000  css/
    1648  Defl:N      647  61% 03-10-2008 00:57 c3b9f4d9  css/lightbox.css
       0  Stored        0   0% 03-10-2008 00:57 00000000  images/
      49  Defl:N       44  10% 04-07-2007 20:58 64aff4e0  images/bullet.gif
     222  Defl:N      213   4% 04-07-2007 20:58 10131ca6  images/close.gif
     979  Defl:N      916   6% 04-07-2007 20:58 0415e19c  images/closelabel.gif
     723  Defl:N      728  -1% 04-07-2007 20:58 f3abf2ca  images/donate-button.gif
...
--------          -------  ---                            -------
  244588            94624  61%                            20 files
[23:02:36] ~/Download $ 

gzip文件gunzip -lv file.gz

例:

[23:03:55] ~/Download $ gunzip -lv mudlet.tar.gz 
method  crc     date  time           compressed        uncompressed  ratio uncompressed_name
defla 768774be Feb 14 22:44             2895270             6533120  55.7% mudlet.tar
[23:04:02] ~/Download $ 

只是为了完整性,还为使用bzip2的用户提供了“ bunzip2 -tv file.bz2”。
TextGeek

13

在Max OS X和Linux上,您可以使用zipinfo

zipinfo -m my_file.zip > list_my_file.txt

输出(more list_my_file.txt):

Archive:  my_file.zip
Zip file size: 3220317423 bytes, number of entries: 1998436
drwxrwxr-x  3.0 unx        0 bx  0% stor 15-Nov-26 07:14 p/
-rw-rw-r--  3.0 unx     4666 tx 77% defN 15-Nov-23 23:31 p/r2082514.json
-rw-rw-r--  3.0 unx     4278 tx 78% defN 15-Nov-21 16:39 p/r1190647.json
-rw-rw-r--  3.0 unx     4147 tx 77% defN 15-Nov-23 03:29 p/r1867235.json
-rw-rw-r--  3.0 unx     6866 tx 74% defN 15-Nov-23 01:25 p/r1814510.json
-rw-rw-r--  3.0 unx     6979 tx 78% defN 15-Nov-22 19:40 p/r1675696.json
-rw-rw-r--  3.0 unx     5460 tx 78% defN 15-Nov-22 23:11 p/r1761107.json
-rw-rw-r--  3.0 unx     4960 tx 74% defN 15-Nov-23 00:58 p/r1801562.json
-rw-rw-r--  3.0 unx     6459 tx 75% defN 15-Nov-21 19:00 p/r1261556.json

该标志-m显示压缩率:

-m     list zipfile info in medium Unix ``ls -l'' format.  Identical to
              the -s output, except that the compression factor, expressed  as
              a percentage, is also listed.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.