SSIS File System Task

  • Hi

    I used Foreach loop container to move the data from D:\data to E:\olddata so i used File System Task. In D:\data there is 3 text file with datas having same column name,i need to move to E:\olddata with mereging all the datas to single file.

    say for eg in D:\data text file name as D1.txt(100 records), D2.txt(100 records),D3.txt(100 records) to E:\olddata as E1.txt

    In properties destinationconnection : E:\olddata as E1.txt

    i used File System Task in that file connection manager editor usage type as create file.

    opration :Copy file

    Sorceconnection : D:\data

    i used File System Task in that file connection manager editor usage type as existing file.

    i am getting error as file already exist.it is correct only since for the first time it will create folder and moves the data but for the second time it does not need to create folder thats why i am getting error how to resolve it

    Any other way we can move the data from D:\data (multi) to E:\olddata (single)

    Thanks

    Parthi

    Thanks
    Parthi

  • have you considered robocopy? It have the additional switch which ignore the existing file and copy onle new copies.

    ----------
    Ashish

  • Maybe you can use a small script task to create the folder and an empty file.

    Then, copy the 3 files to the archive and just append the data.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • Hi

    I was not able to do as u said above.Any other way.

    What is robocopy i have not used that one.any script or example will be helpful

    Thanks

    Parthi

    Thanks
    Parthi

  • parthi-1705 (10/28/2010)


    Hi

    I was not able to do as u said above.Any other way.

    What is robocopy i have not used that one.any script or example will be helpful

    Thanks

    Parthi

    Why weren't you able to do it? What did you try? What errors did you get?

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

  • I believe this is a case of file copy/append. What is the issue you are facing. Try using a ST

    Raunak J

  • One idea:

    -Loop through D1.txt, D2.txt, and D3.txt files in D:\data. Instead of trying to move and append using the File System Task, use a Data Flow Task and extract from D:\data and load to your single destination flat file in E:\olddata. Make sure your overwrite property is set to FALSE on your destination flat file. Personally I would append the runtime date to your olddata text file name.

    -In the same Foreach Loop container, have a File System Task that then deletes that same file that you processed from D:\data so that by the time every file is processed nothing is left in your D:\data and you're all set for the next run.

    The same thing could be accomplished by extracting to a table and then loading to your single file in E:\Olddata.

  • Isn't there an option to overwrite the destination file or not in the file system task?

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

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