1

Every time the new file is added in the folder with the new name given by the customer. There is no concatenation happening on the file name. Every file has very different name.

I want to pick up the file by the timestamp or the last modified date of the file inside that single folder. So here we need to traverse the folder by last the timestamp and select only that files which are modified lately with whatever name (doesn’t matter).

There’s everyday one file that gets added in the folder so we are trying to build a scheduled package that picks the latest/current files in the folder and loads it into sql db table.

I have built a for-loop to load entire folder but how to use SSIS for loading selective files like by their latest timestamp?

Can anyone help me with this difficulty?

Thank you in advance.

Ankita Potdar
  • 67
  • 1
  • 9
  • You could use a Script Task to pick the latest one (See a plain C# example [here](https://stackoverflow.com/questions/1179970/how-to-find-the-most-recent-file-in-a-directory-using-net-and-without-looping)). Your script task could then write the filename to a variable. Then in your data source connection, you can set an expression based connection string to use this variable and begin processing... Let me know if you want further details on any of those steps! – thinkOfaNumber Apr 30 '20 at 06:57
  • Thanks a lot. I was looking for a script task but I wasn't sure of using it. Will try with the task. – Ankita Potdar Apr 30 '20 at 07:29

0 Answers0