Character replacement by R Mutt (2.00 / 0) #4 Fri May 09, 2008 at 12:17:34 PM EST
I've got an old VBscript on my desktop that does file renaming. Doesn't do capitals but you could change it to use the UCase or LCase functions. Paste it into a file with a .vbs extension and play around.

Option Explicit

Dim fsoReader
Dim strDir
Dim strFrom
Dim strTo
Dim objFolder
Dim varFile
Dim strName
Dim lngCount

'Initialize
strDir = "F:\AudioBooks\Disk 4"
strFrom = " - Orphans - Disk 4 - "
strTo = "Orphans4 "
lngCount = 0

'Confirm values
strDir = InputBox("Enter folder", "Bulk rename", strDir)
strFrom = InputBox("Rename from", "Bulk rename", strFrom)
strTo = InputBox("Rename to", "Bulk rename", strTo)

Set fsoReader = CreateObject("Scripting.FileSystemObject")
Set objFolder = fsoReader.GetFolder(strDir)

'Get each file
For Each varFile in objFolder.Files
    'New name
    strName = CStr(varFile.Name)
    strName = Replace(strName, strFrom, strTo)

    If CStr(varFile.Name) <> strName Then
        varFile.Name = strName
        lngCount = lngCount + 1
    End If
Next

MsgBox "Done. " & lngCount & " files were renamed"



VBScript reference by R Mutt (2.00 / 0) #5 Fri May 09, 2008 at 12:19:01 PM EST
Here.

[ Parent ]

Edit the file each time? by R Mutt (2.00 / 0) #12 Fri May 09, 2008 at 03:29:37 PM EST
Read the script... it's a GUI at the moment, but you could easily change it to use command line arguments if you prefer.

[ Parent ]

Login
Make a new account
Username:
Password: