1

I have a Holding directory with files in it that are downloaded from FTP throughout the day.

At any time I need to be able to sort the collection and retrieve the file whose CreationTime attribute is the oldest. This file will then be moved from "Holding" to "Pending".

Since I am using an SSIS package to move the file using a System File Task, I need to manipulate an expression based on the CreationDate variable. Trouble is, I am really unfamiliar with this "expression" language you are faced with using in the Expression Builder.

So, how would I retrieve a file whose creation date is the oldest using an expression script?

Or is there an easier way to do what I want to do with a Script Task?

Isaiah Nelson
  • 2,450
  • 4
  • 34
  • 53
  • 1
    Dupe/check out my answer on http://stackoverflow.com/questions/8831060/import-most-recent-csv-file-to-sql-server-in-ssis – billinkc Feb 29 '12 at 21:07

1 Answers1

1

you will have to loop trough the files on a script task and inside this script check the last created, load its name to a global variable and then use it on your System File Task

this may help you: http://www.simple-talk.com/sql/ssis/adding-the-script-task-to-your-ssis-packages/

Diego
  • 34,802
  • 21
  • 91
  • 134