How to use the latest file in a folder for source

2019-03-04 00:35发布

I have an SSIS package which pulls in a CSV file for processing which pulls one file for the source \\server\dash\LABORDERS.CSV and is working fine.

enter image description here

We wanted to keep older files for historic purposes so everyday there will be new files instead of just overwriting the old one and it looks like this:

enter image description here

I know I am suppose to add a script task but I am not sure where to add it and how to invoke it so that the source file is always looking in the folder for the latest file and using that file to transfer data to it's sql destination.

How can I achieve it?

1条回答
再贱就再见
2楼-- · 2019-03-04 00:59

What have you tried? You can could create a script task at the start of your control flow that uses the .NET framework filesystem objects to search a directory and get the file with the most recent timestamp. You could then assign that file name to a SSIS Variable, then use that variable in your file connection manager.

查看更多
登录 后发表回答