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...
[Windows] Need a simple Post processing script $$
Re: [Windows] Need a simple Post processing script $$
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 $$
Thank you, I'll give it a go first thing tomorrow morning!
Re: [Windows] Need a simple Post processing script $$
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).
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 $$
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.
*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.
Re: [Windows] Need a simple Post processing script $$
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
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 $$
I think this could be accomplished...
That move command *should* move the entire folder in to your CopyToDir.
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