Tuesday, February 21, 2012

Retrieve date from filename

Hye all,

I need help on this.

Let say my source file in excel format. Currently i'm using foreach loop to execute those source files. The problem is that , i want to retrieve a date from the source(filename) itself. i've tried using derived column. but it doesnt work.

eg: Source file name Email_Jan_05.xls, i want to grab the string JAN and 05 which later i'm going to put it in my database.

any suggestion? Thanks in advance.

Inside foreach loop, insert a script task before the data flow task, create a presedence constraint between them. Inside the script task, obtain the file date and store it in some variable.|||

Thanks Michael.

Anyway, do u have any source code / syntax or reference for this?

|||I don't have any code at hand, but look at System.IO.File.GetCreationTime and System.IO.File.GetLastWriteTime (depending on what time you need).

No comments:

Post a Comment