Dan,
I didn't read your original post quite right. The code I replied with will
only do one level of subfolders below the C_FOLDER_NAME, and it won't do
files. The code below will rename all files and all levels of subfolders.
As before, change C_FOLDER_NAME to the appropriate folder name, and run
StartRename. It will call DoOneFolder and that calls itself recursively to
do all files and all levels of subfolders.
Sub StartRename()
Const C_FOLDER_NAME = "C:\Test"
Dim FSO As Object
Dim TopFolder As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
Set TopFolder = FSO.getfolder(C_FOLDER_NAME)
DoOneFolder TopFolder
End Sub
Sub DoOneFolder(FolderObj As Object)
Dim FileObj As Object
Dim SubFolderObj As Object
Dim LCName As String
For Each FileObj In FolderObj.Files
LCName = LCase(FileObj.Name)
FileObj.Name = "___" & FileObj.Name
FileObj.Name = LCName
Next FileObj
For Each SubFolderObj In FolderObj.subfolders
LCName = LCase(SubFolderObj.Name)
SubFolderObj.Name = "___" & SubFolderObj.Name
SubFolderObj.Name = LCName
DoOneFolder SubFolderObj
Next SubFolderObj
End Sub
--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
(email address is on the web site)
"Dan R." wrote in message
ups.com...
Wow, very impressive, I wasn't expecting any feedback on this one...
Thanks a lot Chip,
-- Dan