none
Adding Sequence number to XLSX file names for in for each loop container RRS feed

  • Question

  • Hi All,

    I want to append a sequence number to XLSX files in For-each loop container. Basically I want to load no of XLSX files in to staging table and move those to Success or failure folders based on those status. In this situations I may get few files with same filenames. but I want to move and keep these save in failure or success folders for the client requirement. for now we cant save same files with same name in those folders. so I want append sequence number to filenames like

    Test1-(1).xlsx ,

    Test1-(2).xlsx.

    Test1-(3).xlsx

    .etc...  Please see screen shot for the reference.

    Any suggestions or links for these type of scenarios could be gr8.

    Thanks 

    Monday, September 30, 2019 10:02 AM

All replies

  • Hi there,

    Since the ForEach loop caches the names before executing the Excel Source at runtime would not be able to resolve the new file name.

    You need to do a preliminary step where you rename the files and then let me be processed via the existing ForLoop.

    This preliminary step can also be a ForEach Loop with a File System [Move] Task.


    Arthur

    MyBlog


    Twitter

    Monday, September 30, 2019 1:22 PM
    Moderator
  • Hi Srisai4me,

    Check if this is helpful.

    Move File Using File System Task in SSIS

    Regards,

    Zoe


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, October 1, 2019 6:09 AM
  • Hi Arthur,

    Thanks for the reply. I am using Filesystem task to move this file with in for-each loop container to success folder. But how can I append sequence number while renaming or moving to success folder ? this file should save with sequence number if already file exist in success folder. 

    If possible could you please provide the details as step wise could be appreciated. 

    Thanks

    Tuesday, October 1, 2019 10:15 AM
  • Hi Zoe,

    Thanks for the reply. I am already using Filesystem task. But I want to move this file with sequence added after the file name dynamically if any file existing with same name in success or failure folder like appending DATETIME to filename like.

    Thanks

    Tuesday, October 1, 2019 10:18 AM
  • Hi Srisai4me,

    Check if this is helpful.

    Regards,

    Zoe


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, October 2, 2019 2:42 AM