How to change name of file to upper case and extension to lower case?
Solution 1
Not a batch script but a PowerShell script:
# Get all items in the current directory
Get-ChildItem | %{
# Construct a new file name
$newFilename = ($_.BaseName.ToUpper())+($_.Extension.ToLower());
# Move the file
Move-Item $_ $newFilename
}
Solution 2
You could use ReNamer's "Case" renaming rule:
Case: All upper case (skip extension), Extension lower case
You can save your rules as a preset and use it to rename files/folders via command line and also in a batch file, e.g. ReNamer.exe /rename <preset> <files-and-directories>
Solution 3
Sorry because i cant comment but for do it in one liner you do :
Get-ChildItem | % { Move-Item -Path $_ -Destination (($_.BaseName.ToUpper())+($_.Extension.ToLower())) }
Related videos on Youtube
![Amir](https://i.stack.imgur.com/ylFnx.jpg?s=256&g=1)
Amir
I am a hardworking and motivated software engineer who has acquired extensive knowledge in the field through the study of software engineering at the PhD level. I have working experience in the information technology and financial industry in the insurance sector. I am looking for a new challenge on my career path to fulfil my experience in a different career path with new opportunities. Moreover, I am keen to learn new technologies and I am a victim of developaralysis...
Updated on September 18, 2022Comments
-
Amir almost 2 years
I have some files as shown in below:
input: ObjectName.TXT
I want to convert name of the file to Upper case while extention should be in lower case by using batch file. please help me how to convert my object name as below
output: OBJECTNAME.txt
I need to convert object names in windows for using in Solaris and Linux.
-
DavidPostill almost 8 yearsI think you have
ToLower
andToUpper
the wrong way around looking at the question ... -
Seth almost 8 yearsCorrect, rima submitted a change and I accepted it. Should be the right way around now.