itkamaraj helped me with a related script, but this script doesnt work. It gives me a error:
The file names are:
Wind Attn Coeff Tunnel - 474.wrl
Wind Attn Coeff Tunnel - 475.wrl
Wind Attn Coeff Tunnel - 476.wrl, etc.
I expect the script below to increment the above as:
Wind Attn Coeff Tunnel - 534.wrl
Wind Attn Coeff Tunnel - 535.wrl
Wind Attn Coeff Tunnel - 536.wrl, etc.
But it doesnt work. Please help. The error that I get is: rename.vbs(10, 2) Microsoft VBScript runtime error: Invalid procedure call or argument: 'Mid'
filename: rename.vbs
--------------------------------------------
Dim WshShell, oExec
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")
objStartFolder = "R:\temp\RUN2-VRML-DAT\Train\temp\"
Set objFolder = objFSO.GetFolder(objStartFolder)
Set colFiles = objFolder.Files
For Each objFile in colFiles
startpos=instr(objFile.Name,"-")
endpos=instr(objFile.Name,".dat")
Number=Mid(objFile.Name,startpos+3,(endpos-(startpos+3)))
Number=Number+60
Fpart=Mid(objFile.Name,1,startpos)
Spart=Mid(objFile.Name,(Len(objFile.Name)-3),4)
newFileName=Fpart & " " & Number & Spart
wscript.echo "OLD FILE : " & objFile.Name & " NEW FILE : " & newFileName
FileName = objStartFolder & "\\" & objFile.Name
newFileName = objStartFolder & "\\" & newFileName
'objFSO.moveFile FileName, newFileName
Next
-----end of script--------