Hi I have 2 files which has to be renamed. details below
Input folder:
ABC_123_yyyy-mm-dd-hh-min-ss.csv
ABC_456_yyyy-mm-dd-hh-min-ss.csv
I have to rename the files to
DEF_yyyymmddhhminss.CSV
DEF_yyyymmddhhminss+1.CSV
Since both files are created with same timestamp i need to just increment the seconds by 1 so that i will get 2 output files.
Im able to replace the hyphens and underscore and even the first part of renaming(ABC_123 to DEF and ABC_456 to DEF). I need help on how to rename only the seconds and extension of file from .csv to .CSV
the code i have used is as below. pls help
Input folder:
ABC_123_yyyy-mm-dd-hh-min-ss.csv
ABC_456_yyyy-mm-dd-hh-min-ss.csv
I have to rename the files to
DEF_yyyymmddhhminss.CSV
DEF_yyyymmddhhminss+1.CSV
Since both files are created with same timestamp i need to just increment the seconds by 1 so that i will get 2 output files.
Im able to replace the hyphens and underscore and even the first part of renaming(ABC_123 to DEF and ABC_456 to DEF). I need help on how to rename only the seconds and extension of file from .csv to .CSV
the code i have used is as below. pls help
Code:
Const folder = "c:\temp\Input_File\"
With CreateObject("Scripting.FileSystemObject")
On Error Resume Next
For Each file In .GetFolder(folder).Files
file.Name = Replace(file.Name, "-", "")
file.Name = Replace(file.Name, "_", "")
file.Name = Replace(file.Name, "ABC123", "DEF_")
Next 'file
End With 'FSO