Rename file using timestamp

  • Hi,

    I am moving a file to another folder after processing. I want to append the month, year and time. I have been able to append yr and month using this

    (DT_STR, 2, 1252) Month( @[System::StartTime] )+ (DT_STR, 4, 1252) Year( @[System::StartTime] )

    How to append the time to this?

    thanks

  • I use a Script Task to format the date for creating an archive subdirectory using a datestamp.  You can use the same mechanism to format the datetime stamp for renaming a file.  I have modified this snippit from the process I use, take it and change it as you see fit:

    Dim FileDate As String

    FileDate = Format(Dts.Variables("StartTime").Value, "yyyyMMddhhmmss")

    Dts.Variables("DestinationFileLocation").Value = CStr(Dts.Variables("DestinationFileLocation").Value) & "\" & FileDate

    Dts.TaskResult = Dts.Results.Success

    hth

    😎

  • thanks

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

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