12
1
Is there a way, in windows, to use 7z.exe's list command such that the copyright heading, file information, and column headers are skipped and you're left with just a terse machine-readable list of files within the archive?
Right now I get this
>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
What I want to see is just this:
>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
I don't think there's an in-built option in 7-zip... Is there any specific reason you have to use 7-zip? Are alternative utilities/methods acceptable? Which version of Windows is in question? – Ƭᴇcʜιᴇ007 – 2015-12-31T17:10:58.017
In a larger scope... how is your example output any more 'machine readable', than the normal output? To me it's not any easier, as the fields don't seem delimited consistently, so the parsing/processing you'll probably have to do to the output anyway (to deal with that) could easily include skipping the first and last 'X' amount of lines... So why not just parse/process 7-zip's output (via scripting or whatever) before passing it along to the next step? – Ƭᴇcʜιᴇ007 – 2015-12-31T17:15:57.623
7zip is ideal (but not necessary) because it works with many different types of archive formats and the list command gives just the right set of information that I need. – ivanatpr – 2015-12-31T17:18:48.787
I realize I can parse the output to remove the unwanted lines, I just wanted to ask if there was a built-in way of doing this before going that route because the sum line's formatting is very similar to the regular file list lines so the regex is nontrivial. – ivanatpr – 2015-12-31T17:20:47.463
1I wouldn't bother with Regex to remove the lines, as they will probably always be the same number/amount at top and bottom. But regardless, if your question is specifically "Can 7-zip do this?" then I'm pretty certain the answer is simply "No". If you want a solution to your actual problem, then we'll need more info so we can provide a non-7-zip solution. – Ƭᴇcʜιᴇ007 – 2015-12-31T17:23:46.360