RAR/ZIP folder after download ?

Come up with a useful post-processing script? Share it here!
Post Reply
0DAY
Newbie
Newbie
Posts: 20
Joined: August 25th, 2012, 9:56 am

RAR/ZIP folder after download ?

Post by 0DAY »

How can i RAR/ZIP folder after download ?
User avatar
sander
Release Testers
Release Testers
Posts: 8822
Joined: January 22nd, 2008, 2:22 pm

Re: RAR/ZIP folder after download ?

Post by sander »

Find or create a post processing script for that
User avatar
OfficerDoofy
Newbie
Newbie
Posts: 9
Joined: January 18th, 2011, 5:26 am

Re: RAR/ZIP folder after download ?

Post by OfficerDoofy »

What filesize, compression etc?
eyegeegeewhy
Newbie
Newbie
Posts: 2
Joined: November 21st, 2012, 6:08 pm

Re: RAR/ZIP folder after download ?

Post by eyegeegeewhy »

Whipped this up in autoit, You will need to unzip the linked zip file into your scripts folder (this is windows only).

file = http://dl.dropbox.com/u/16063106/swpps- ... ectory.zip

You should see three items,
"swpps-zip_directory_additional" - This is a folder that holds the 7zip command line tool to do the zipping.
"swpps-zip_directory.au3" - This is the autoit source file, you don't need this but you can open it it a text editor if your interested how this works or wanted to compile it yourself.
"swpps-zip_directory.exe" - This is the above file once turned into something that sabnzbd can execute.



The code is below (same as au3 file)

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
Post Reply