klewis10367
MIS
How do I use the current date and time in the renaming process within this code. Right now I am just using the date. I want to add time also.
Function Main()
Dim FSO, sFileName
Set fso = CreateObject("Scripting.FileSystemObject")
sfilename=("\\mbhqrdp01\Exports\GDMManual\gpexport.txt")
' Check for file and return appropriate result
If FSO.FileExists(sFilename) Then
Main = DTSStepScriptResult_ExecuteTask
Set bFile = fso.GetFile("\\mbhqrdp01\Exports\GDMManual\gpexport.txt")
aYear = year(now)
aMonth = month(now)
aDay = day(now)-1
filename = "gdm" &aMonth &aDay&aYear&".txt"
bFile.move ("\\mbhqrdp01\Exports\gdm\"&filename)
Else
Main = DTSStepScriptResult_ExecuteTask
End If
Set FSO = Nothing
End Function
Function Main()
Dim FSO, sFileName
Set fso = CreateObject("Scripting.FileSystemObject")
sfilename=("\\mbhqrdp01\Exports\GDMManual\gpexport.txt")
' Check for file and return appropriate result
If FSO.FileExists(sFilename) Then
Main = DTSStepScriptResult_ExecuteTask
Set bFile = fso.GetFile("\\mbhqrdp01\Exports\GDMManual\gpexport.txt")
aYear = year(now)
aMonth = month(now)
aDay = day(now)-1
filename = "gdm" &aMonth &aDay&aYear&".txt"
bFile.move ("\\mbhqrdp01\Exports\gdm\"&filename)
Else
Main = DTSStepScriptResult_ExecuteTask
End If
Set FSO = Nothing
End Function