Page 1 of 1

rename filenames 'Extensions' EVEN in SubFolders

Posted: 09 Apr 2010 18:12
by jamesfui
hi everyone!
what is the bat scripts for Renaming filenames 'Extensions' EVEN in SubFolders..
in reference to its filenames... like for example,

c:\old files\pictures\album01\filenames01.bMp
c:\old files\pictures\album01\filenames02.BmP
TO
c:\old files\pictures\album01\filenames01.BMP
c:\old files\pictures\album01\filenames02.bmp

the main objective is to rename all the extension to uppercase in respect with its filename01 & filename02 to extension in lowercases!!
But have to be able to Run through even in Sub-folders too..

like the scripts destination can just set to c:\old files\
instead of the long full path c:\old files\pictures\album01\

thanks!! :mrgreen:

Re: rename filenames 'Extensions' EVEN in SubFolders

Posted: 10 Apr 2010 01:35
by !k

Code: Select all

@echo off
for /f "delims=" %%f in ('dir /s /b /a-d "c:\old files"') do (
if /i "%%~xf"==".bmp" ren "%%~dpnf.bmp" "%%~nf.BMP"
)

Re: rename filenames 'Extensions' EVEN in SubFolders

Posted: 12 Apr 2010 09:38
by avery_larry
*untested* probably a bit more efficient:

Code: Select all

for /f "delims=" %%f in ('dir /s /b /a-d "c:\old files\*.bmp"') do ren "%%f" "%%~nf.BMP"