Page 1 of 1

[Windows] Need a simple Post processing script $$

Posted: December 5th, 2013, 11:03 am
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...

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

Posted: December 19th, 2013, 5:24 pm
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

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

Posted: December 24th, 2013, 8:29 pm
by Tarom
Thank you, I'll give it a go first thing tomorrow morning!

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

Posted: December 25th, 2013, 12:31 pm
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).

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

Posted: December 25th, 2013, 12:46 pm
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.

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

Posted: December 29th, 2013, 5:06 am
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

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

Posted: January 14th, 2014, 1:19 pm
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.