RAR/ZIP folder after download ?
Posted: November 17th, 2012, 9:59 am
How can i RAR/ZIP folder after download ?
Code: Select all
#include <File.au3>
$sFinalDirectory = $CmdLine[1]
$sNzbFileName = $CmdLine[2]
$sCleanJobName = $CmdLine[3]
$sIndexReportNum = $CmdLine[4]
$sUserDefinedCategory = $CmdLine[5]
$sNzbGroup = $CmdLine[6]
$PostProcStatus = $CmdLine[7]
;variable for the archive in the folder above the source folder
$sArchive = _PathFull($sFinalDirectory & "\" & "..") & "\" & $sCleanJobName & ".zip"
;variable that shows the location of the command line version of 7zip
$s7ZipExe = @ScriptDir & "\swpps-zip_directory_additional\7za.exe"
;variable for the parameters to pass to 7zip, 'a' = add '-tzip' = type zip the rest is the archive file to create and where to put it
$s7ZipParams = 'a -tzip' & ' ' & '"' & $sArchive & '"' & ' ' & '"' & $sFinalDirectory & '"'
;set envirnment variable to temporarily stop irritating File Security Warning.
EnvSet("SEE_MASK_NOZONECHECKS", "1")
; Run 7zip cmd to zip up the folder
ShellExecuteWait($s7ZipExe, $s7ZipParams)
; set the environment variable back again.
EnvSet("SEE_MASK_NOZONECHECKS", "0")
; check if the archive exists. If it does return 0 so SAB knows everything is fine else return 1.
If FileExists($sArchive) Then
ConsoleWrite("Archive created " & $sArchive)
$ret = 0
Else
ConsoleWrite("Archive not created something likely went wrong")
$ret = 1
EndIf
Exit $ret