Click here to monitor SSC
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in
Home       Members    Calendar    Who's On

Add to briefcase

SSIS-get latest file from a group of files based on last modified date Expand / Collapse
Posted Wednesday, March 27, 2013 8:13 AM


Group: General Forum Members
Last Login: Friday, August 1, 2014 8:41 AM
Points: 101, Visits: 437
Hi All,

I have a set of csv files that is being backed up in a folder on daily basis.

Say FOr eg:
File Modified Data
Country.csv 27/03/2013 09:00:01 AM
Geography.Csv 27/03/2013 09:00:01 AM
Product.csv 27/03/2013 09:00:02 AM
CUsomer.cSV 27/03/2013 09:00:02 AM
Country.csv 26/03/2013 09:00:02 AM
Geography.Csv 26/03/2013 09:00:02 AM
Product.csv 26/03/2013 09:00:01 AM
CUsomer.cSV 26/03/2013 09:00:01 AM
Country.csv 25/03/2013 09:00:02 AM
Geography.Csv 25/03/2013 09:00:03 AM
Product.csv 25/03/2013 09:00:01 AM
CUsomer.cSV 25/03/2013 09:00:01 AM

This way I have files backedup in the folder for 5 plus days...

I'll have four packages to pick up the data from Country, Geography,Product and Customer and load the same in to four different tables...I am able to write a script code to identify the latest file from the path...But I wanted to hardcode the filename some where in the package, so that particualr package will check for the latest file (say Cusomer), it will search for all the Customer files and pick up the latest and load into db.

Any help on this ?


I wanted to pick up the latest file from the folder and load the same into the database
Post #1435928
Posted Wednesday, March 27, 2013 3:31 PM


Group: General Forum Members
Last Login: Wednesday, March 9, 2016 9:48 PM
Points: 20, Visits: 90
not sure if this is the exact outcome you were hoping for but i would declare a variable for the file name, use file system task to move the file to another directory after being loaded to a table, that way you could probably hardcode the first part of the name of the file to be picked up i.e. customer*.csv to be loaded to the relevant table.
Post #1436194
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse