Convert filenames to upper case

Microsoft Windows
Post Reply
User avatar
MigrationUser
Posts: 336
Joined: 2021-Jul-12, 1:37 pm
Contact:

Convert filenames to upper case

Post by MigrationUser »

11 Sep 2008 18:30
perky999


I have a need to convert the files in a folder from lower case to upper case, but I am having trouble locating the proper command(s) to do what I want. Any ideas?

----------------------------

#2 12 Sep 2008 10:56
bluesxman

Code: Select all

@echo off
REM to use, just drop a directory onto the script icon
set dttm=%date:/=%_%time::=%
set yourFolder=%1

for %%a in ("%yourFolder%\*.*") do (
    set file=%%a
    for %%Z in (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
        call :casefix %%Z
    )
    call :rename "%%~a"
)

pause

goto :EOF

:casefix

call set file=%%file:%~1=%~1%%

goto :EOF


:rename

echo:"%~1" ^> "%file%"

move "%~1" "%file%_%dttm%"
move "%file%_%dttm%" "%file%"

goto :EOF
The sub-procs are my way of avoiding enabling delayed expansion (in case of "!" in the file names).

Last edited by bluesxman (12 Sep 2008 10:57)

cmd | *sh | ruby | chef

----------------------------

#3 12 Sep 2008 14:09
perky999


Bluesxman,

Thanks again for you help and insight. My background does not include a whole lot of DOS, so your help is greatly appreciated.
Post Reply