locked
How to Loop Files based on Date Modified using Foreach loop Container in ssis. RRS feed

  • Question

  • Hi.

    I want to loop through files based on Modified Date. Please let me know how to achive this.

    If we want to use script then please provide me the Script.

    Tuesday, January 21, 2014 1:30 PM

Answers

  • Assuming files are all in same folder you can use foreachloop with file enumerator to iterate through files. Then inside file use below logic in a script task to get datemodified value.

    http://msdn.microsoft.com/en-us/library/zds3tce6(v=vs.90).aspx

    Once you get it you can store it in a variable created in ssis and then use it for further processing. or if you want it for looping store filename along with datemodified inside a ADO recordset inside script task. then have a further loop to loop through files in the order of modified date value you stored.


    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

    • Proposed as answer by Mike Yin Friday, January 24, 2014 6:45 AM
    • Marked as answer by Mike Yin Sunday, February 2, 2014 1:48 PM
    Tuesday, January 21, 2014 2:14 PM