For legal reasons, my company is trying to scrub a specific acronym from our entire file system. A search returns nearly 30,000 instances of said acronym. I have written the following VBS using the suggestions here to attempt to make the process recursive. Unfortunately, I failed to properly implement it.
I am getting an "Invalid procedure call or argument" error in line 3. If I edit it to reference the root folder, I instead get an Object required: 'File' error in line 18.
Set objFso = CreateObject("Scripting.FileSystemObject")
Set Folder = objFSO.GetFolder("<folderpath>")
TraverseFolders objFso.GetFolder(strPath)
Function TraverseFolders(fldr)
For Each File In Folder.SubFolders
sNewFile = File.Name
sNewFile = Replace(sNewFile, "old acronym", "new acronym")
If (sNewFile <> File.Name) Then
File.Move(File.ParentFolder + "\" + sNewFile)
End If
Next
For Each sf In fldr.SubFolders
TraverseFolders sf
Next
sNewFile = File.Name
sNewFile = Replace(sNewFile, "old acronym", "new acronym")
If (sNewFile <> File.Name) Then
File.Move(File.ParentFolder + "\" + sNewFile)
End If
End Function
What am I missing to make this work recursively?