Skip to content

Instantly share code, notes, and snippets.

@4ndrew
Created January 11, 2012 16:40
Show Gist options
  • Save 4ndrew/1595537 to your computer and use it in GitHub Desktop.
Save 4ndrew/1595537 to your computer and use it in GitHub Desktop.
Bulk files rename on Windows without tools (for stackoverflow)
Path = "C:\Users\put-your-folder-name-here"
Set FSO = CreateObject("Scripting.FileSystemObject")
Sub visitFolder(folderVar)
For Each fileToRename In folderVar.Files
fileToRename.Name = "Agreement " & fileToRename.Name
Next
For Each folderToVisit In folderVar.SubFolders
visitFolder(folderToVisit)
Next
End Sub
If FSO.FolderExists(Path) Then
visitFolder(FSO.getFolder(Path))
End If
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment