Monday, March 12, 2012

Retrieving and storing file timestamp

I have a package that processes a flat file, which is generated by a separate system each weekday around 3:30AM. I would like my package to store the timestamp of the input file and compare it to the timestamp of the next day's file. If they are the same, then the package can exit without reprocessing a particular file again.

So, my first question is whether a package variable can be updated so that its value will persist from one run to the next?

Second, what is the syntax to retrieve the file's timestamp, either directly from the file connection manager or within a script task?

Thanks,

Phil

Philsky wrote:

I have a package that processes a flat file, which is generated by a separate system each weekday around 3:30AM. I would like my package to store the timestamp of the input file and compare it to the timestamp of the next day's file. If they are the same, then the package can exit without reprocessing a particular file again.

So, my first question is whether a package variable can be updated so that its value will persist from one run to the next?

No! That'd be nice wouldn't it. I've requested similar functionality in the past although not formally via the Product Feedback Center. Perhaps you could submit it?

Philsky wrote:

Second, what is the syntax to retrieve the file's timestamp, either directly from the file connection manager or within a script task?

Thanks,

Phil

There's some code here that shows how you can access this information: http://blogs.conchango.com/jamiethomson/archive/2005/10/10/2253.aspx

Check lines 7 & 8 of the first code block.

-Jamie

No comments:

Post a Comment