Jump to content

7Zip Commandline - Output Error Logging Syntax?


Recommended Posts

Hi all,

Long time lurker and now forum poster! I'm writing a relatively simple backup script for my firm that automates the copy, compression and organization of Leaver's data on one of our secured NAS systems. I personally found the best method to do this so far was to use 7zG.exe (GUI version of 7Zip which can use command-line too) and it functions quite well!

I would like to retrieve more info on whether any warnings or errors happen in 7Zip during the backup, but I can't quite get my head around the syntax and switches for reading out, it seems any adjustment I make to the RunWait call's string seems to break the backup or give unexpected repercussions! Hopefully its something silly I'm doing as I don't code very often.

Here is the working version:

; Compress the directories one by one in the zip using the listfile....
Local $iPID = RunWait(@ScriptDir & "\bin\7zG.exe a -mx" & $compressionQuality & " -v" & $compressSplitFileSize & " -wc:\temp " _
         & $backupToLocation & "\" & $userDirectory & ".7z @bin\listfile.txt -x@bin\excludefile.txt", "", @SW_SHOWDEFAULT, $STDOUT_CHILD)

Ultimately I would love to switch entirely to 7za.exe (standalone) so that I can read the progress percentage, current file being uploaded and any warnings or errors could be processed and output to the AutoIT script's GUI I've created rather than jumping in and out of two applications per se.

 

Link to comment
Share on other sites

What do you get when you set the log level using

-bb[0-3]

as described here?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

On 2/16/2018 at 3:17 PM, water said:

What do you get when you set the log level using

-bb[0-3]

as described here?

Cheers @water with your help and a small change to the use of double quotation marks, that did the trick!

; Compress the directories one by one in the zip using the listfile....
Local $iPID = Run(@ScriptDir & '\bin\7z.exe a -mx' & $compressionQuality & ' -v' & $compressSplitFileSize & ' -wc:\temp "' _
         & $backupToLocation & '\' & $userDirectory & '.7z" @bin\listfile.txt -x@bin\excludefile.txt -bb3', "", @SW_SHOWDEFAULT, $STDIO_INHERIT_PARENT)

I switched to single quotation marks after I realized when reading through the 7Zip command-line guide, that double quotes should be used around the folder locations, especially if they have any whitespace. The next step is to poll what's logged to the console and push it to the GUI.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...