File name with Date

  • Hi i have a file that i need to import into my db but the file name is dynamic its has a name like ACB_20070213.log how can i handle this within my DTS... can i create some active x code to rename it ?

     

  • Hi Ken, thanks for the links

    I've pick this example but i don't understand one thing..

    For the source file i use this line

    strFilePath = "C:\TEMP\ASL_" & strFileDate

    But where does  the new file name go ? the destination location ??

    I created a Gobal varaible call OutputFilePath and give gave it tha path of C:\TEMP\

    Function Main()

     Dim dtPreviousDate

     Dim strFileDate

     Dim strFilePath

     Dim objFSO

     Dim Result

     

     dtPreviousDate = DateAdd("d", -1 , Date() )

     strFileDate = Year(dtPreviousDate) & Right("0" & Month(dtPreviousDate), 2) & Right("0" & Day(dtPreviousDate), 2)

     strFilePath = "C:\TEMP\AS1_" & strFileDate

     Set objFSO = CreateObject("Scripting.FileSystemObject")

     If objFSO.FileExists(strFilePath) Then

      DTSGlobalVariables.Parent.Connections("OutputFilePath").DataSource = strFilePath

      Result = DTSTaskExecResult_Success

     Else

      Result = DTSTaskExecResult_Failure

     End If

     Set objFSO = Nothing

     Main = Result

    End Function

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply