SQL Server Performance

How to pick up files based on creation date using For Each Enumerator

Discussion in 'SQL Server 2005 Integration Services' started by surr79, Feb 9, 2009.

  1. surr79 New Member


    Hi,
    I need to pick data from CSV files one by one from a specific folder and put the data retrieved (in each CSV file) to a table in DB. At the end of processing, I need to delete all the CSV files from that specific folder.
    I just heard about the For-each Enumerator in SSIS. How can I utilize For-Each enumerator for my requirement? Will there be any option in For-each container to delete CSV files? or should I have to write separate task to do that? If need to write separate task, what task would help me and how to use that?
    Thanks in advance,
    Suresh
  2. satya Moderator

  3. alaina.menahem New Member

    did you found a solution.i would like to also delete some files thatin a folder base on the date.
    the date the file was moved to the folder.then if that file is 7 days older it should be deleted.Can you help me out there?
  4. arunyadav Member

    [quote user="alaina.menahem"]
    i would like to also delete some files thatin a folder base on the date.
    the date the file was moved to the folder.then if that file is 7 days older it should be deleted.Can you help me out there?
    [/quote]
    echo on
    rem First Delete old SQL Backup Files
    FORFILES /p C:filename /s /m *.* /d -7 /c “CMD /C del /Q @FILE”
    rem pause
    Save the script with a .bat or .cmd extension and schedule it using the Windows Scheduled Tasks applet.
    Refer to FORFILES COMMAND DETAILS for More details.

Share This Page