Extracting a 7-Zip file "silently" - command line option

sambha picture sambha · Sep 23, 2010 · Viewed 63k times · Source

I want to extract a 7-Zip archive in a Python script. It works fine except that it spits out the extraction details (which is huge in my case).

Is there a way to avoid this verbose information while extracting? I did not find any "silent" command line option to 7z.exe.

My command is

7z.exe -o some_dir x some_archive.7z

Answer

Matthew picture Matthew · Jul 24, 2012

I just came across this when searching for the same, but I solved it myself! Assuming the command is processed with Windows / DOS, a simpler solution is to change your command to:

7z.exe -o some_dir x some_archive.7z > nul

That is, direct the output to a null file rather than the screen.

Or you could pipe the output to the DOS "find" command to only output specific data, that is,

7z.exe -o some_dir x some_archive.7z | FIND "ing archive"

This would just result in the following output.

Creating archive some_archive.7z

or

Updating archive some_archive.7z**


My final solution was to change the command to

... some_archive.7z | FIND /V "ing  "

Note double space after 'ing'. This resulted in the following output.

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18

Scanning

Updating some_archive.7z


Everything is Ok

This removes the individual file processing, but produces a summary of the overall operation, regardless of the operation type.