Is there a way to rename all files in a specific folder to uppercase with batch file?
I found this code. But it renames files to lowercase. How to modify it to rename to uppercase instead?
for /f "Tokens=*" %f in ('dir /l/b/a-d') do (rename "%f" "%f")
This can be achieved with Microsoft PowerToys PowerRename feature. It adds a context menu to bulk-rename files, including the ability to capitalise and use Regular Expression.
To rename multiple files from File Explorer, select all the files you wish to rename, then press the F2 key. The name of the last file will become highlighted. Type the new name you wish to give to every file, then press Enter.
You can press and hold the Ctrl key and then click each file to rename. Or you can choose the first file, press and hold the Shift key, and then click the last file to select a group.
@echo off
setlocal enableDelayedExpansion
pushd c:\some_dir
for %%f in (*) do (
set "filename=%%~f"
for %%A 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 (
set "filename=!filename:%%A=%%A!"
)
ren "%%f" "!filename!" >nul 2>&1
)
endlocal
This will put the extension to upper case as well.... Which was a problem for me... So this how I "kept" extension as lower case...
@echo off
setlocal enableDelayedExpansion
pushd "\...\PATH_TO_FOLDER\"
for %%f in (*) do (
set "filename=%%~f"
for %%A 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 (
set "filename=!filename:%%A=%%A!"
)
ren "%%f" "!filename!" >nul 2>&1
)
for /r "\...\PATH_TO_FOLDER\" %%G in (*.PDF) do ren "%%~G" *.pdf
endlocal
replace \...\PATH_TO_FOLDER\ with your path and .PDF/.pdf with your file extention as needed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With