[Windows] Need a simple Post processing script $$

Come up with a useful post-processing script? Share it here!
Post Reply
Tarom
Newbie
Newbie
Posts: 7
Joined: January 12th, 2013, 2:25 pm

[Windows] Need a simple Post processing script $$

Post by Tarom »

Hi!
I am looking for a very simple script for Windows that would take files downloaded by Sabnzbd to a competed folder at "D:\Program Files\TV" and copy them to "F:\TV Unsorted". Thats it. I looked through the forums and found a few posts and even tried a solution, - ended up loosing over a 300 files in unrelated directory (why did start deleting files in a non related dir is beyond me)... That gave me a scare. Could someone more capable then me lend me a hand?

Thanks.

P.S: To show my gratitude, I am willing to pitch in a few bucks in Bitcoin to your wallet...
bmupton
Newbie
Newbie
Posts: 9
Joined: November 9th, 2012, 7:14 pm

Re: [Windows] Need a simple Post processing script $$

Post by bmupton »

Copy this to a file called something like movefiles.bat in your sab post process folder:

Code: Select all

@ECHO OFF

REM MAKE SURE THIS DIRECTORY EXISTS
REM ALSO MAKE SURE YOU END IN A TRAILING SLASH
SET CopyToDir="F:\TV Unsorted\"

setlocal
pushd "%~1"
move /Y * %CopyToDir%
popd

exit
Tarom
Newbie
Newbie
Posts: 7
Joined: January 12th, 2013, 2:25 pm

Re: [Windows] Need a simple Post processing script $$

Post by Tarom »

Thank you, I'll give it a go first thing tomorrow morning!
Tarom
Newbie
Newbie
Posts: 7
Joined: January 12th, 2013, 2:25 pm

Re: [Windows] Need a simple Post processing script $$

Post by Tarom »

Update:

I modified directories and tested that it works:
@ECHO OFF

REM MAKE SURE THIS DIRECTORY EXISTS
REM ALSO MAKE SURE YOU END IN A TRAILING SLASH
SET CopyToDir="F:\Mama Filmi\"

setlocal
pushd "F:\TV Unsorted\"
move /Y * %CopyToDir%
popd

exit

When run, script successfully moves files from "F:\TV Unsorted\" to "F:\Mama Filmi\" located within the folder. What I've noticed it that it ignores files located in directories, any files located in sub dirs ex: - "F:\TV Unsorted\XXX\123.avi" are ignored.

Should I substitute "move" for "xcopy"? -Accordingly to what I found that is the only command that copies dirs and subdirs. This is what I came up with:

REM MAKE SURE THIS DIRECTORY EXISTS
REM ALSO MAKE SURE YOU END IN A TRAILING SLASH
SET CopyToDir="F:\Mama Filmi\"

setlocal
pushd "F:\TV Unsorted\"
xcopy /Y /s * %CopyToDir%
popd

exit

Crossing my fingers, since the last time I tried xcopy, it ended up in a disaster, - I lost like 300 files (not very important ones, but still).
Tarom
Newbie
Newbie
Posts: 7
Joined: January 12th, 2013, 2:25 pm

Re: [Windows] Need a simple Post processing script $$

Post by Tarom »

Ok, I can confirm that it copies files and dirs successfully when executed. Ok, it's kinda a lame question, I tried looking for the answer, does SABnzbd accept scripts as *.bat files? Or do I need some other format? - Bmupton, pm sent.


*Update* - yes SABnzbd accepts *.bat files. Worked like a charm.
Last edited by Tarom on December 29th, 2013, 4:12 pm, edited 1 time in total.
chongwho
Newbie
Newbie
Posts: 10
Joined: November 22nd, 2013, 4:17 pm

Re: [Windows] Need a simple Post processing script $$

Post by chongwho »

This script seems to be working pretty well for me. However it seems to move the completed individual files
ie: sab\downloading\moviename\moviename.mkv (movie file)
and sab\downloading\moviename\moviename.srt (subtitle file)
to the correct place: sab\completed\moviename.mkv and sab completed moviename.srt

However I would prefer it moved the whole folder, for example: sab\compled\moviename\ rather than just moving the individual files to the completed folder.

Can anyone help with this?
Thanks
bmupton
Newbie
Newbie
Posts: 9
Joined: November 9th, 2012, 7:14 pm

Re: [Windows] Need a simple Post processing script $$

Post by bmupton »

I think this could be accomplished...

Code: Select all

@ECHO OFF

REM MAKE SURE THIS DIRECTORY EXISTS
REM ALSO MAKE SURE YOU END IN A TRAILING SLASH
SET CopyToDir="F:\TV Unsorted\"

setlocal
move /Y "%~1" %CopyToDir%

exit
That move command *should* move the entire folder in to your CopyToDir.
Post Reply