Rename files with timestamp and move to archive folder

  • How to rename multiple excel files from a source folder to a destination folder with timestamps attached to it ?

    I have used a file system task inside a foreach container to move the files using variables. It works but I am not able to rename the files.

  • Not sure what you mean when you say you cannot rename the file.

    When you copy the file, the file name in the destination should be the new name that you want. Is that what you're trying to do?



    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]

  • Thanks . I first copied the files to the destination folder with timestamp attached to them using a file system task and then deleted the files with another FTP task.

    Thanks for your help.

  • Take the File Name in an variable and add the following in the Script Task.

    Dim vFileName, vDate, vFilePath As String

    vFileName = CStr(Dts.Variables("v_FileName").Value)

    vDate = Now.Date.ToString("yyyy/MM/dd")

    vFilePath = vFileName & "_" & vDate & ".xls"

    Dts.Variables("v_TextFileName").Value = vFilePath

    Then Use File System Task to rename file with Source as v_FileName and destination varialbe as v_TextFileName.

    Then Move the v_TextFileName to the desired destination folder.

    Hope this may Help!

  • Please, check the following links.

    Thanks

    http://www.rafael-salas.com/2007/03/ssis-file-system-task-move-and-rename.html

  • Hi

    I had to do similar things recently and have documented the process... Please find attached are some docs that may be off help to you...

    Cheers

    vani

Viewing 6 posts - 1 through 5 (of 5 total)

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