7-zip list output to file

2010-02-09
2013-04-04
  • Jac Messerschmidt

    How to output the list produced by 7-zip to a file when in command line mode? I've tried the -o and -so switches, but that only produces errors. I'm running the commandline version 7za465 on Windows XP.

     
  • fernando

    fernando - 2010-02-09

    Try…

    7z l archive.7z >output.txt
    
     
  • Jac Messerschmidt

    Sorry ikxcsshcm7, that didn't work. Even when I provided an empty file, nothing was written to it. I also added a space after > but that also produced nothing. Any other ideas?

     
  • fernando

    fernando - 2010-02-11

    What is the command line you are using to output the list produced by 7-zip to the screen?

     
  • Jac Messerschmidt

    I use a vanilla "7za l file.7z" to get screen output, no problem. But if you add anything to that (e.g. > output.txt) it ignores you. If you try to use -o or -so switches it gets real nasty and hangs or even throws up an error 7!

     
  • fernando

    fernando - 2010-02-11

    The only way to get output to a file is to use redirection…

    $ :: Showing Directory:
    $ DIR/B
    file.7z
    $ :: Listing Archive Contents with 7za:
    $ 7za L file.7z
    7-Zip (A) 4.65  Copyright (c) 1999-2009 Igor Pavlov  2009-02-03
    Listing archive: file.7z
    Method = LZMA
    Solid = +
    Blocks = 1
    Physical Size = 384308
    Headers Size = 258
       Date      Time    Attr         Size   Compressed  Name
    ------------------- ----- ------------ ------------  ------------------------
    2006-02-28 06:00:00 ....A        55776       384050  chimes.wav
    2006-02-28 06:00:00 ....A        97016               chord.wav
    2006-02-28 06:00:00 ....A        80856               ding.wav
    2006-02-28 06:00:00 ....A       119384               notify.wav
    2006-02-28 06:00:00 ....A        25434               recycle.wav
    2006-02-28 06:00:00 ....A         1192               start.wav
    2006-02-28 06:00:00 ....A       171100               tada.wav
    ------------------- ----- ------------ ------------  ------------------------
                                    550758       384050  7 files, 0 folders
    $ :: Listing Archive Contents with 7za and Redirecting Output to File:
    $ 7za L file.7z >output.txt
    $ $ :: Showing Directory Again:
    $ DIR/B
    file.7z
    output.txt
    $ :: Displaying Contents of Output File:
    $ TYPE output.txt
    7-Zip (A) 4.65  Copyright (c) 1999-2009 Igor Pavlov  2009-02-03
    Listing archive: file.7z
    Method = LZMA
    Solid = +
    Blocks = 1
    Physical Size = 384308
    Headers Size = 258
       Date      Time    Attr         Size   Compressed  Name
    ------------------- ----- ------------ ------------  ------------------------
    2006-02-28 06:00:00 ....A        55776       384050  chimes.wav
    2006-02-28 06:00:00 ....A        97016               chord.wav
    2006-02-28 06:00:00 ....A        80856               ding.wav
    2006-02-28 06:00:00 ....A       119384               notify.wav
    2006-02-28 06:00:00 ....A        25434               recycle.wav
    2006-02-28 06:00:00 ....A         1192               start.wav
    2006-02-28 06:00:00 ....A       171100               tada.wav
    ------------------- ----- ------------ ------------  ------------------------
                                    550758       384050  7 files, 0 folders
    $
    
     
  • Jac Messerschmidt

    Thanks, ikxcsshcm7.  Your suggestion still does not not work, of course, because of that pesky "7za L file.7z >output.txt" call that flatly refuses to do anything. I was hoping there was a simple in-line command that could do the job. Perhaps that's a nice challenge for Mr Pavlov to get his teeth into.

    As is is, I devised a simple workaround in Delphi and that works fine although it's not very elegant or efficient. But it works.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks