Click here to Skip to main content
15,889,216 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I have folders in this path C:\Customer\

Folder Names :04012019, 04022019, 04032019

I want to pick the latest folder(04032019) dynamically and need to process all the files in that folder.

Can anyone please help me how to achieve this in ssis .

Thanks in advance!!

What I have tried:

I know how to get a latest file bu using script task .but i am not sure how to get a latest folder using datestamp.
Posted
Updated 6-May-19 1:51am
v2
Comments
[no name] 4-May-19 14:20pm    
https://docs.microsoft.com/en-us/sql/integration-services/ssis-designer?view=sql-server-2017

Put the date in a db table with a "preprocessor" step.

https://docs.microsoft.com/en-us/sql/integration-services/ssis-quickstart-run-dotnet?view=sql-server-2017
Member 11931581 4-May-19 14:23pm    
I don't see anything related in the provided link.could you please check it once

Use a (C#) script task to get the folder names and convert them to datetime objects using the DateTime.TryParseExact method. When you find the "latest" one, set a package variable to the folder name.
 
Share this answer
 
Solution

EXEC master.sys.xp_dirtree 'C:\Customer\,1,0' <pre>

This will give all folder data .. then fetch latest amongst them .. try and test for multiple level by putting 4/5 instead 1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900