使用 7zip 命令行列出 zip 文件的内容,并提供非详细的机器友好输出

使用 7zip 命令行列出 zip 文件的内容,并提供非详细的机器友好输出

在 Windows 中,有没有办法使用 7z.exe 的列表命令,以便跳过版权标题、文件信息和列标题,而只留下存档中简洁的机器可读文件列表?

现在我明白了

>7z.exe l Test.zip

7-Zip [64] 9.38 beta  Copyright (c) 1999-2014 Igor Pavlov  2015-01-03

Listing archive: Test.zip

--
Path = Test.zip
Type = zip
Physical Size = 29966218

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2015-11-01 23:52:49 ....A     14887917     14256660  01 - Bitter Sweet Symphony.mp3
2015-10-30 22:45:48 ....A     16567208     15709214  06 - Hallelujah.mp3
------------------- ----- ------------ ------------  ------------------------
2015-11-01 23:52:49           31455125     29965874  2 files

Kernel  Time =     0.000 =    0%
User    Time =     0.000 =    0%
Process Time =     0.000 =    0%    Virtual  Memory =      2 MB
Global  Time =     0.010 =  100%    Physical Memory =      6 MB

我想看到的只是这个:

>7z.exe l Test.zip

2015-11-01 23:52:49 ....A     14887917     14256660  01 - Bitter Sweet Symphony.mp3
2015-10-30 22:45:48 ....A     16567208     15709214  06 - Hallelujah.mp3

答案1

7z v15.xx 引入了一些新的开关:

  • -sltl- 显示命令的技术信息
  • -ba - 抑制标题;未记录。

设置这些开关的输出如下所示:

D:\TruLaLa> 7z l -ba -slt test.7z
Path = 2.msi
Size = 2005506
Packed Size = 638340
Modified = 2009-04-16 23:00:00
Attributes = 
CRC = B6FFF2FF
Encrypted = -
Method = LZMA:3m
Block = 0

Path = 1.doc
Size = 35328
Packed Size = 
Modified = 2008-12-06 23:00:00
Attributes = 
CRC = C041B41F
Encrypted = -
Method = LZMA:3m
Block = 0
...
Path = 2+.log
Size = 303250
Packed Size = 
Modified = 2015-03-13 18:57:32
Attributes = A
CRC = 5C738A96
Encrypted = -
Method = PPMD:o32:mem192m
Block = 1
...
Path = 3.txt
Size = 0
Packed Size = 0
Modified = 2015-10-13 01:46:41
Attributes = A
CRC = 
Encrypted = -
Method = 
Block = 

对于我们机器人来说,这种格式肯定更具可读性。)

相关内容