Hello!
I have zero experience with scripting. I am using the latest SAB with Windows. The built in features for categories, and clean up file list work perfectly.
I have tried searching this forum for over an hour and cannot find a solution. I want my TV shows to be organized in a particular way. I would like a script that works on Windows that would rename the .avi to the name of the .nzb or folder it is in. Since folder names are that of the NZB, it doesn't matter which one is used... whatever is more convenient. Then once that is complete, I would like for it to move that .avi to the folder directly outside of where it is currently located. However, if there are more than one .avi, then I would like for it to terminate the script and not do any renaming/moving at all.
For example,
1. NZB is downloaded: SHOW.NAME.S01E01.HDTV.XviD-GROUP.nzb
2. Once downloaded it shows \Downloads\TV\SHOW.NAME.S01E01.HDTV.XviD-GROUP\blah.avi
3. If more than one .avi file is found, terminate script otherwise run script.
3. If script is run, blah.avi should be renamed to SHOW.NAME.S01E01.HDTV.XviD-GROUP.avi and moved to \Downloads\TV
Would really appreciate any help!
Thank You.
How To: Rename .avi to the name of NZB on Windows?
How To: Rename .avi to the name of NZB on Windows?
SABnzbd v0.6.0 Alpha 10 w/ Windows 2008 Server R2
Server Specs: i3 530 | Asus P7H55D-M EVO | 2GB Crucial DDR3 | 8TB of Storage
Server Specs: i3 530 | Asus P7H55D-M EVO | 2GB Crucial DDR3 | 8TB of Storage
Re: How To: Rename .avi to the name of NZB on Windows?
After doing TONS of searching. I found an existing Windows script that is similar to what I want... but also did things I do not want. So I modified it for my needs and it works GREAT! Special props go to the user PiNPOiNT.
Here is the code. Just rename it to a .bat file:
Now I just need help with one more task. How do I have it move the .avi it just renamed to a particular folder? I tried using "MOVE !ParentFolder!.avi D:\Downloads\Usenet\Complete\# TV" and ""MOVE *.avi D:\Downloads\Usenet\Complete\# TV"" by putting them in the last line of the first IF statement but it did not work. :c(
Any suggestions?
Here is the code. Just rename it to a .bat file:
Code: Select all
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
CLS
REM ********CHANGE PATH BELOW TO YOUR ROOT MOVIE FOLDER*********
CD /D D:\Downloads\Usenet\Complete\# TV
FOR /R . %%A IN (.) DO (
REM ECHO Checking for TV in %%A
SET ParentFolder="%%~nxA"
SET FileCount=0
FOR %%B IN ("%%~A"\*.avi) DO (
SET /A FileCount+=1
SET FileName="%%~B"
)
IF !FileCount! EQU 1 (
ECHO Renaming !FileName! to !ParentFolder!.avi
REN !FileName! !ParentFolder!.avi
)
IF !FileCount! GTR 1 (
ECHO Too many .avi files!
)
)
Now I just need help with one more task. How do I have it move the .avi it just renamed to a particular folder? I tried using "MOVE !ParentFolder!.avi D:\Downloads\Usenet\Complete\# TV" and ""MOVE *.avi D:\Downloads\Usenet\Complete\# TV"" by putting them in the last line of the first IF statement but it did not work. :c(
Any suggestions?
SABnzbd v0.6.0 Alpha 10 w/ Windows 2008 Server R2
Server Specs: i3 530 | Asus P7H55D-M EVO | 2GB Crucial DDR3 | 8TB of Storage
Server Specs: i3 530 | Asus P7H55D-M EVO | 2GB Crucial DDR3 | 8TB of Storage