Simple renaming question

I want to rename all fileextensions inside a folder that are called ".srt.ass" to just ".ass"

My (poor code so far is):

or %x in (*.srt.ass) do RENAME "*.srt.ass" "*.ass"

Thanks in advance.

Do you have windows versions of any unix tools installed? Specifically, do you have sed installed? It could really help with transforming file extensions.

I would prefer it without sed... except perhaps if I could use a simple "sed.exe" that reqires no installation or something.

However feel free to post a sed approach.

Here is how it would work, if you are interested in considering use of sed.

c:\xxx>dir /b *.ass
1.srt.ass
2.srt.ass
c:\xxx>type rename.bat
@echo off
REM Write list of files to file
dir /b *.srt.ass > rename2.bat

REM Change "a.srt.ass" to "RENAME a.srt.ass a.ass"
sed "s:\(.*\).srt.ass:RENAME & \1.ass:" rename2.bat > temp.bat
move /y temp.bat rename2.bat

REM Run batch file to make changes
call rename2.bat
c:\xxx>.\rename.bat

c:\xxx>dir /b *.ass
1.ass
2.ass

The sed command makes a substitution, like "s:Old:New:". For the "Old" part, It saves everything at the beginning of the line before the extensions. For the "New" part it says RENAME, and then the original file name (&) and then the new file name using the part if saved (\1).

Maybe someone else knows how to do this just with BATCH programming.

This is kinda tricky, as you are not renaming an extension, but part of of the actual file name. Your files aren't a ".srt.ass" type, they are still a ".ass" type. If you do want to get rid of the .srt in the filename, run these commands, or put them in a batch file.

ren *.ass *.
ren *.srt *.ass

I tested this method in Win XP and it appeared to work for me.