Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- rem qBittorrent command line: C:\Torrents\Download\Move_RACE.bat "%N" "%L" "%F" "%C"
- set MedFol=%~dp0
- set Log=%MedFol%Move_RACE_Log.txt
- rem Get yesterday's date to rename files.
- for /f %%a in ('cscript //nologo %MedFol%yd.vbs') do set yd=%%a
- set yr=%yd:~0,4%
- set mn=%yd:~4,2%
- set dy=%yd:~6,2%
- set yesterday=%yr%.%mn%.%dy%
- REM *** Change year at the first of each racing season. ***
- set year=2023
- set season=Season %year%
- REM name (Torrent Name) is used to find the NASCAR Series.
- set name=%1
- REM category, NASCAR, AMA, TV Show, Movie
- set category=%2
- set contentpath=%3
- set filecount=%4
- set rootpath=%5
- set savepartition=O:\Media\Video\Racing
- rem If category is NASCAR
- if %category%==NASCAR goto NASCAR
- rem If category is AMA
- if %category%==AMA goto AMA
- goto NR
- :NASCAR
- echo ********************************************* >> %Log%
- echo Torrent Name: %name% >> %Log%
- echo **%category% >> %Log%
- echo Start: %date% at %time% >> %Log%
- REM Check to see which NASCAR Series the race is.
- if not x%name:Cup=%==x%name% goto CS
- if not x%name:Truck=%==x%name% goto TS
- if not x%name:Xfinity=%==x%name% goto XS
- if not x%name:ARCA=%==x%name% goto AR
- :CS
- set sername=NASCAR.Cup.Series
- set series=NASCAR Cup Series\%season%
- 'if not %filecount%=="1" goto copyall
- goto copyone
- :TS
- set sername=NASCAR.Truck.Series
- set series=NASCAR Truck Series\%season%
- 'if not %filecount%=="1" goto copyall
- goto copyone
- :XS
- set sername=NASCAR.Xfinity.Series
- set series=NASCAR Xfinity Series\%season%
- if not %filecount%=="1" goto copyall
- goto copyone
- :AR
- set sername=NASCAR.ARCA.Series
- set series=
- NASCAR ARCA Series\%season%
- 'if not %filecount%=="1" goto copyall
- goto copyone
- :AMA
- echo ********************************************* >> %Log%
- echo Torrent Name: %name% >> %Log%
- echo **%category% >> %Log%
- echo Start: %date% at %time% >> %Log%
- set sername=AMA.Supercross
- set series=AMA Supercross\%season%
- 'if not %filecount%=="1" goto copyall
- goto copyone
- :copyone
- rem Copies one MKV file from contentpath to todir appending yesterday's date to the beginning of the file name.
- set todir="%savepartition%\%series%\"
- rem Remove quotes from original todir
- set todir=%todir:"=%
- echo Copy one file >> %Log%
- echo Copy From: %contentpath% >> %Log%
- echo Copy To: %todir% >> %Log%
- REM *** Start Copy ***
- echo copy "%contentpath%" "%todir%%sername%.%yesterday%.%name%" >> %Log%
- copy "%contentpath%" "%todir%%sername%.%yesterday%.%name%" >> %Log%
- REM *** End Copy ***
- goto errchk
- :copyall
- rem Copies all "race" MKV files from contentpath to todir appending yesterday's date to the beginning of the file name.
- set todir="%savepartition%\%series%\"
- rem Remove quotes from original todir
- set todir=%todir:"=%
- echo Copy multi files >> %Log%
- echo Copy From: %contentpath% >> %Log%
- echo Copy To: %todir% >> %Log%
- REM *** Start Copy ***
- pushd %contentpath%
- setlocal
- setlocal enabledelayedexpansion
- for %%a in (*race*.mkv) do (
- echo copy "%%a" "%todir%%category%.%yesterday%.%%a" >> %Log%
- copy "%%a" "%todir%%sername%.%yesterday%.%%a" >> %Log%
- )
- endlocal
- popd
- REM *** End Copy ***
- goto errchk
- :errchk
- if errorlevel 4 goto errors
- if errorlevel 0 goto noerrors
- :errors
- echo Copy FAILED Error: %errorlevel% >> %Log%
- echo Insufficient memory to copy files or >> %Log%
- echo invalid drive or command-line syntax. >> %Log%
- goto EOF
- :noerrors
- echo Copy complete >> %Log%
- goto EOF
- :EOF
- echo Finish: %date% at %time% >> %Log%
- :NR
- end
Add Comment
Please, Sign In to add comment