I have a pretty small VB script here that just trims a leading space off of file names for a given folder. The problem is when it runs it throws an error message if that same file name already exists. Is there a way to tell the script to overwrite a file if the file name already exists? Syntax below:
Set objFSO = CreateObject("Scripting.FileSystemObject")
strFolderName = "\\CORP***\***Share\Common\RFI Validation Outputs"
Set objFolder = objFSO.GetFolder(strFolderName)
Set colFiles = objFolder.Files
For Each objFile in colFiles
objFSO.MoveFile strFolderName + "\" + objFile.Name , strFolderName + "\" + LTrim(objFile.Name)
Next