SSIS move file to archive folder with a timestamp

  • Hi,

    I am trying to move the processed file to the archived folder with timestamp attached using SSIS . i have used a for each loop container and within it a file system task for moving the file . But is not able to adda timestamp to the file while moving .

    I am using Excel connection manager to loop through different files in a folder.

    Thanks

  • could you be more specific? do you want to add time stamp to the name ?

  • Yes, to the name of the file while moving to the archive folder

  • You'll have to use an expression for the destination filename. That expression should concatenate the timestamp with the original filename.



    Alvin Ramard
    Memphis PASS Chapter[/url]

    All my SSC forum answers come with a money back guarantee. If you didn't like the answer then I'll gladly refund what you paid for it.

    For best practices on asking questions, please read the following article: Forum Etiquette: How to post data/code on a forum to get the best help[/url]

  • Yes , you have to use expressions and this can also be done using script

    following is an example for Expression, which attaches date to the name

    "MP_CCRET"+

    Right((DT_WSTR, 4)year(getdate()) ,2)

    + ( len((DT_WSTR, 2) Month(getdate()) )< 2 ? "0" +(DT_WSTR, 2) Month(getdate()) : (DT_WSTR, 2) Month(getdate()))

    +

    ( len((DT_WSTR, 2) day(getdate()) )< 2 ? "0" +(DT_WSTR, 2) day(getdate()) : (DT_WSTR, 2) day(getdate()))

    rt("ss",getdate()) : (DT_WSTR, 2) datepart("ss",getdate()))

    +".txt"

  • What is "MP_CCRET" ? IS this added to the File System task ? Please elaborate.

  • It is just an example in my case..date will be appeneded along with the text i mentioned in double quotes

  • Once the file is processed...as in your case...have a Script task or FST(File Rename)

    have a variable(s) and follow the approach Alvin has mentioned

    Raunak J

Viewing 8 posts - 1 through 7 (of 7 total)

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