Hi...
I have a list of files in the format:
123-1-0001.tif
123-1-0002.tif
123-1-0003.tif
124-4-0001.tif
124-4-0002.tif
I need to rename the FIRST dash (4th character)to an underscore like this:
123_1-0001.tif
123_1-0002.tif
123_1-0003.tif
124_4-0001.tif
124_4-0002.tif
I have been using the following script to repalace any dash with an underscore, but not sure how to modify so only the first dash (4th character) is renamed, not the additional dash (6th character)
Anyone have a suggestion for me?
Thanks!
Brian
I have a list of files in the format:
123-1-0001.tif
123-1-0002.tif
123-1-0003.tif
124-4-0001.tif
124-4-0002.tif
I need to rename the FIRST dash (4th character)to an underscore like this:
123_1-0001.tif
123_1-0002.tif
123_1-0003.tif
124_4-0001.tif
124_4-0002.tif
I have been using the following script to repalace any dash with an underscore, but not sure how to modify so only the first dash (4th character) is renamed, not the additional dash (6th character)
Code:
sPath = "."
set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sPath)
Set FCol = oFolder.Files
For Each File In FCol
strFileName = File
strNewFile = Replace(strFileName,"-","_")
oFSO.Movefile strFileName, strNewFile
Next
Anyone have a suggestion for me?
Thanks!
Brian