Question from the customer:

I would like to pick a specific file on a different server at a particular time if it was modified in the last 2 hrs and load data from it into the database. If the file was not updated in the last 2 hrs a mail needs to be sent to the responsible personnel.

Solution:

There are several ways fo doing it, as usual, you can write a script to check the modification date or you can use transformations for it. Transformation is an easier option. Create two transformations First, one will be used to check file modification date Second one for loading the data.

Checking file modification date

Set DataReader source type to File System and enter the file name into the mask box.

DataReaderProperties

TransformationOpen Validator and create validation as in the picture below The logic is very simple We use compare value to check if the modified date is less than two hours ago and if it is we set result to true Then we use Is Equal to abort execution

Validator

Objects properties

ChangeDateProperties

CompareValuesProperties

IsEqualToProperties

Package

Package

Note:

The file might be locked for editing so we try to copy it first

Direct link, no registration required.