Renaming *.nfo files to match their *.mkv's -
trying organize shows *.nfo files have same name mkv(edit:avi woops doesn't change code) match.
test folder: 76107.2.1.nfo 76107.2.2.nfo 76107.2.3.nfo doctor - s02e01 (009) - planet of giants (1) - planet of giants.avi doctor - s02e01 (009) - planet of giants (2) - dangerous journey.avi doctor - s02e01 (009) - planet of giants (3) - crisis.avi
now episode numbers in 76107.2.*.nfo's wrong in later folders similarity in test folder because first of season. can't compare names match them in right order i'm trying use counters rename first *.nfo same first *.avi , second *.nfo same second *.avi , on!
i made script thought should work it's doing nothing. appreciated! edit works aacini except odd bug noted under code.
@echo on setlocal enabledelayedexpansion set cnta=0 set cntb=0 %%b in (*.avi) ( set /a cnta=cnta+1 set line_!cnta!=%%~nb ) %%c in (*.nfo) ( set /a cntb=cntb+1 %%i in (!cntb!) ren "%%~fc" "!line_%%i!.nfo" )
bug: first nfo seems bumped end of list place still kept. in every other nfo named match appropriate avi.
test 1 (original test folder) results: .nfo doctor - s02e01 (009) - planet of giants (1) - planet of giants.avi doctor - s02e01 (009) - planet of giants (2) - dangerous journey.avi doctor - s02e01 (009) - planet of giants (2) - dangerous journey.nfo doctor - s02e01 (009) - planet of giants (3) - crisis.avi doctor - s02e01 (009) - planet of giants (3) - crisis.nfo test 2 (added bonus file) results: doctor - s02e01 (009) - planet of giants (1) - planet of giants.avi doctor - s02e01 (009) - planet of giants (2) - dangerous journey.avi doctor - s02e01 (009) - planet of giants (2) - dangerous journey.nfo doctor - s02e01 (009) - planet of giants (3) - crisis.avi doctor - s02e01 (009) - planet of giants (3) - crisis.nfo doctor - s02e01 (009) - planet of giants (4) - making of planet of giants.avi doctor - s02e01 (009) - planet of giants (4) - making of planet of giants.nfo
some folders contain bonus videos @ end of list not have matching nfo's @ end. read nfo's verify ".nfo"(test 1)/"doctor - s02e01 (009) - planet of giants (4) - making of planet of giants.nfo"(test 2) misplaced should of been "doctor - s02e01 (009) - planet of giants (1) - planet of giants.nfo"
the right term name line_!cnta!
variables array. may review complete description of array management in batch files @ this post. example, code may fixed way:
edit: small bug fixed
@echo on setlocal enabledelayedexpansion set cnta=0 set cntb=0 %%b in (*.mkv) ( set /a cnta=cnta+1 set line_!cnta!=%%~nb ) /f "delims=" %%c in ('dir /b *.nfo') ( set /a cntb=cntb+1 %%i in (!cntb!) ren "%%~fc" "!line_%%i!.nfo" )
Comments
Post a Comment