Rename multiple AVI files batch

January 7, 2010 at 08:54:30
Specs: Windows XP
Running Windows 7
Dos Command line, batch file, or VB

I can use any help with the following

Rename multiple AVI files change characters curly bracket to parentheses.

Example:

Before
Commando {1985}.avi
Forrest Gump {1994}.avi
The Godfather {1972}.avi

After
Commando (1985).avi
Forrest Gump (1994).avi
The Godfather (1972).avi

Thank you


See More: Rename multiple AVI files batch

Report •


#1
January 7, 2010 at 13:57:24
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b *.avi') do (
set S=%%a
set S=!S:^{=^(!
set S=!S:^}=^)!
ren "%%a" "!S!"
)


=====================================
Helping others achieve escape felicity

M2


Report •

#2
January 8, 2010 at 11:09:26
Works great thank you, I made couple of changes like *.* instead of *.avi no problem, changed [] to parentheses worked good. I tried to rename more than one character the batch file didn’t work!

2 things need help with,
1- I would like to change for more than one word in a file name.
2- Can I use wildcard to make change (1985) using (*)?

Thank you in advance!


Report •

#3
January 8, 2010 at 11:26:06
I'm not quite following but if you post the script you're trying to make work, I'll give it a look.


=====================================
Helping others achieve escape felicity

M2


Report •

Related Solutions

#4
January 8, 2010 at 11:51:47
I would like to rename multiple files change characters between the close parentheses and file extension

Example:

Before
Commando (1985) unrated movie.avi
Forrest Gump (1994) special edition.avi
The Godfather (1972) widescreen format.avi

After
Commando (1985).avi
Forrest Gump (1994).avi
The Godfather (1972).avi

Thank you


Report •

#5
January 8, 2010 at 12:49:27
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b *.avi') do (
set S=%%~Na
call :sub1
ren "%%a" "!NAME!.avi"
)

goto :eof

:sub1
for /f "tokens=1-9 delims=)" %%i in ("!S!") do (
set NAME=%%i^)
)

goto :eof


=====================================
Helping others achieve escape felicity

M2


Report •

#6
January 8, 2010 at 13:09:09
You did it again! Thank you

I changed the script using wildcard,No Problem! Works great.:-)


@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b *.*') do (
set S=%%~Na
call :sub1
ren "%%a" "!NAME!.*"
)

goto :eof

:sub1
for /f "tokens=1-9 delims=)" %%i in ("!S!") do (
set NAME=%%i^)
)

goto :eof


Report •


Ask Question