6

I have a legacy directory structure from a desktop application that I'm porting to an Android application, and Android doesn't want the names of the files to have capital letters in them. I had originally decided to suck it up and rename them by hand (about a hundred files), but then I found that Windows was thwarting even those attempts: QuotationMarks.png -> quotationmarks.png doesn't even stick, because Windows is case-insensitive: it doesn't even register it is as a filename change. I'd have to QuotationMarks.png -> quotationmarks2.png -> quotationmarks.png for all files, which I would like to avoid.

So is there some kind of secret power app that will allow to perform this operation batch?

3 Answers3

9

Command line:

for /F %a in ('dir /L /B') do ren %a %a

batch:

for /F %%a in ('dir /L /B') do rename %%a %%a
STTR
  • 6,891
3

This VBScript will do it. Be sure to set the variable objStartFolder to the right location. Save as a .VBS and double click to run. It will rename all the files in the specified directory to all lower case.

Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "C:\Myfolder"

Set objFolder = objFSO.GetFolder(objStartFolder)

Set colFiles = objFolder.Files
For Each objFile in colFiles
    ObjFSO.MoveFile objStartFolder & "\" & ObjFile.Name, objStartFolder & "\" & lcase(ObjFile.Name)
Next

PS. Technically, I am not renaming the file, but moving it, but the results are the same. Renaming the file will fail, since the filename already exists.

Keltari
  • 75,447
0

While VBScript is in the process of deprecation, amazingly cmd is still around!
UpperLowerProper is a batch folder/file renamer. The UpperLowerProper.bat requires the input name of the target directory in the MYBASEGAME variable. Being a game installation renamer, it also requires the name of an existing file in the directory, which is input by editing the MYBASEGAME value.