Write this code on a notepad and save it with .vbs extension. It asks you the path of the folder and the string to be replaced in each filename and the new string by which the old string is to be replaced.
Set fso = CreateObject ("Scripting.FileSystemObject")
Dim uu, uu1
total_files_renamed = 0
total_files_skipped = 0
root
set fso = nothing
Sub root
path = inputbox ("enter path")End Sub
old_string=inputbox ("enter string to be replaced")
new_string=inputbox ("enter new string")
Set folder_path = fso.GetFolder(path)
msgbox "Warning: All files within the Folder """ & _
folder_path.Path & """ will be renamed."
procedure_sub_folders folder_path , old_string, new_string
Msgbox "Total Files Renamed :" & total_files_renamed
Msgbox "Total Files Skipped :" & total_files_skipped
msgbox "Path and names of files which are renamed" & uu1
Sub procedure_sub_folders (ByVal curr_folder, ByVal old_val, ByVal new_val)
Set Folders = curr_folder.SubFoldersend Sub
procedure_folder curr_folder , old_val, new_val
For Each Folder in Folders
procedure_sub_folders Folder , old_val, new_val
next
Sub procedure_folder (ByVal folder, ByVal old_val, ByVal new_val)
Set Files = folder.FilesFor Each File In FilesIf inStr(1,File.Name,old_val) > 0 ThenNext
uu= Replace(File.Path, old_val, new_val)
uu1= uu1 & vbcrlf & uu
File.Move Replace(File.Path,old_val,new_val)
total_files_renamed = total_files_renamed + 1
else
total_files_skipped = total_files_skipped + 1
End IfEnd Sub