Rename file using BAT commands (remove -en)

November 5, 2010 at 04:53:00
Specs: Windows XP
Hi there,
I have the following filenames:

myfile-en.xls
other example-en.pdf
one more example-en.xls

I need to remove the "-en" and let only the following:
myfile.xls
other example.pdf
one more example.xls

Is it possible, using a BAT command
Thanks a lot,
Marcelo


See More: Rename file using BAT commands (remove -en)

Report •

#1
November 5, 2010 at 05:04:19
@echo off
setLocal EnableDelayedExpansion
set n=
for %%i in (*) do (
set /a n+=1
set name=%%i
set origname!n!=%%i
set newname!n!=!name:-en=!
)
set count=
:loop
set /a count+=1
rename "!origname%count%!" "!newname%count%!"
if %count%==%n% goto done
goto loop
:done

Report •

#2
November 5, 2010 at 05:16:52
That's perfect !!
Thanks !

Report •
Related Solutions


Ask Question