What I have here is a script to create a torrent for specific sites (I am into classic movies of the 1950's and older) and it renames them with that sites initials in the new torrent. Right now it will rename the file:
Donald And Pluto (1936).avi.torrent ----> Donald And Pluto (1936). -- ILC.torrent
Code: Select all
REN *mkv.torrent *.a || REN *avi.torrent *.a || REN *mp4.torrent *.a
REN *.a *." -- ILC
REN *." -- ILC" *." -- ILC.torrent
For personal reasons I would like to remove the first period out of the name but have been having issues with it. I tried using this code and while it would show it renamed in the dos window it never actually did anything.
Code: Select all
@echo off
setlocal enabledelayedexpansion
set deletestring=.avi
for /f "delims==" %%F in ('dir /b /l *.torrent ^| find "%deletestring%"') do (
set oldfilename=%%F
set newfilename=!oldfilename:%deletestring%=!
echo Ren "!oldfilename!" "!newfilename!"
)
While the code below works well (even though it adds that first period in the name) I would like some help on how to clean it up if possible. Try and make the script a bit shorter so I can let others I know use it. I am not sure how I could do this so I am here asking for help on it.
Code: Select all
@ECHO OFF
:INTRO
COLOR 8F
CLS
REM Set to where you have mktorrent installed.
SET MKT=C:\Keydrive\Media\MKTorrent\mktorrent.exe
REM Add your trackers here.
SET AT=-a "http://animetorrents.me/announce.php" -c AnimeTorrents -p -l 17
SET CG=-a "http://cinemageddon.net/announce.php" -c Cinemageddon -p -l 20
SET KG=-a "http://karagarga.in/tracker.php/PersonalHashKey/announce" -c Karagara -p
SET SC=-a "http://www.secret-cinema.net/announce.php?" -c SecretCinema -p
SET BTN=-a "http://landof.tv/PersonalHashKey/announce" -c BroadcastTheNet -p
SET ILC=-a "http://www.iloveclassics.com/announce.php" -c ILoveClassics -p
SET PTP=-a "http://please.passthepopcorn.me:2710/PersonalHashKey/announce" -c PassThePopcorn -p
SET THC=-a "http://horrorcharnel.kicks-ass.org/announce.php" -c TheHorrorChannel -p -l 19
SET TVV=-a "http://tracker.tv-vault.me:34000/PersonalHashKey/announce" -c TV-Vault -p
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
REM You can change the list of trackers but,
REM make sure they match the counter below.
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ 1. ILC ³
ECHO ³ 2. KG ³
ECHO ³ 3. PTP ³
ECHO ³ 4. SC ³
ECHO ³ 5. TVV ³
ECHO ³ 6. BTN ³
ECHO ³ 7. AT ³
ECHO ³ 8. CG ³
ECHO ³ 9. THC ³
ECHO ³ 10. EXIT ³
ECHO ³ 11. SS ³
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
set /a counter=0
set choice=
set /p choice=The torrent you want to make:
set /a counter= %counter%+%choice%
if %counter% ==1 (goto :ILC)
if %counter% ==2 (goto :KG)
if %counter% ==3 (goto :PTP)
if %counter% ==4 (goto :SC)
if %counter% ==5 (goto :TVV)
if %counter% ==6 (goto :BTN)
if %counter% ==7 (goto :AT)
if %counter% ==8 (goto :CG)
if %counter% ==9 (goto :THC)
if %counter% ==10 (goto :EOF)
if %counter% ==11 (goto :SS)
ECHO.
ECHO "%choice%" is not valid...please try again
pause
goto :INTRO
:EOF
EXIT
REM Modify these as needed. They can be in any order.
:ILC
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %ILC% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- ILC.torrent"
goto intro
:PTP
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %PTP% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- PTP.torrent"
goto intro
:KG
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %KG% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- KG.torrent"
goto intro
:TVV
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %TVV% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- TVV.torrent"
goto intro
:BTN
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %BTN% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- BTN.torrent"
goto intro
:AT
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %AT% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- AT.torrent"
goto intro
:THC
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %THC% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- THC.torrent"
goto intro
:SC
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %SC% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- SC.torrent"
goto intro
:CG
FOR %%I IN (*.MP4 *.mkv *.avi) DO %MKT% %CG% "%%I"
for %%a in (*.???.torrent) do for %%b in ("%%~na") do ren "%%a" "%%~nb -- CG.torrent"
goto intro
:SS
FOR %%I IN (*.MP4 *.mkv *.avi) DO CALL \\NICKODEMOS-PC\Users\nickodemos\AppData\Roaming\Microsoft\Windows\SendTo\_SShots.bat "%%I"
Edited to reflect the help given.