Batch script to auto rename subtitles files

June 16, 2009 at 21:40:23
Specs: Windows XP
Hello, I need some help here ;D

I have two types of files in my dir,
movies > .avi
subtitles > .srt

But for the player to show the correct subtitles, the subtitle filename must be same as movie filename, except for the extension.

So I'm trying to make a batch script that auto rename the .srt files to it corresponding movie filename.

For example, I have this files in my dir:


must be renamed to ""

to ""

to ""

Can you help me please? Thanks

See More: Batch script to auto rename subtitles files

Report •

June 17, 2009 at 00:04:51
eduedp, seems to me you could have it read each filename and set it = a variable. Then have it 'test' the variable name and change it if incorrect, then on to the next file, etc. Since it'd occur at machine speed, it'd be very fast.
Ed in Texas.

Report •

June 17, 2009 at 00:26:37
Well I'm almost done with this one.
But I still have a problem. See the ***coments in the batch code

for /F %%a in ('dir /b *.avi ^| findstr /i "S[0-9]*E[0-9]*"')  do (
	for /F %%b in ('dir /b *.srt ^| findstr /i "***the string "SnnEnn" found in last findstr***"')  do ( 
		echo "%%~b"
		echo rename "%%~b" ""

How can I make it? Store only the found string(not the entire line,filename) to a variable to use it later.

Report •

June 19, 2009 at 01:28:52
Thanks for sharing. it's great.

[url=][color=#FFFFFF][u]pret auto[/u][/color][/url]

Report •

Related Solutions

Ask Question