
I got this script wich I use with an older verision of uTorrent (2.2.1), what I want the script to do is either extract or move depending on the files in the downloaded folder to another folder depending on which label the torrent got in uTorrent. I can append stuff like downloaded location and label like this > C:\unpack.bat %D %N %L
Where %D referes to download location, %N refers to the name of the torrent and %L refers to the label it got
But somehow my code dosnt work all that well, and since im quite green on this I was wondering if some jedi batch master could help me out

In short what I want my script to do
IF no label quit (to avoid anything but movies and tv series get extracted since these are the only ones that will have labels)
IF rar files extract them to location/labelname/torrentname
IF no rar files but movie files copy them to location/labelname/torrentname
Code: Select all
@ECHO OFF
rem C:\unpack.bat %D %N %L
SET ouputdir=D:\Downloaded\Torrents\complete\
SET winrarpath="C:\Program Files\WinRAR\WinRAR.exe"
SET input=%1
SET name=%2
SET label=%3
SET output=%outputdir%\%label%\%name%
IF %label%==() GOTO:EOF
IF EXIST %input%\*.rar GOTO extract
IF EXIST %input%\*.mkv GOTO copy
IF EXIST %input%\*.avi GOTO copy
IF EXIST %input%\*.mp4 GOTO copy
GOTO:EOF
:copy
IF NOT EXIST %outputdir%\%label% MKDIR %outputdir%\%label%
IF NOT EXIST %output% MKDIR %output%
xcopy %input%\*.* %output% /S /I /Y
GOTO:EOF
:extract
IF NOT EXIST %outputdir%\%label% MKDIR %outputdir%\%label%
IF NOT EXIST %output% MKDIR %output%
%winrarpath% x -ilog %input%\*.rar *.* %output%
GOTO:EOF
Btw is it possible to match several .rar types with a regexp (like forexample .rar/r01/.r01/.part01 and so forth?)
Thanks for any help given, much appreciated
PS: Optimizations tips are highly welcome
