Forum Discussion
sftp file modified date
vladenache One detail that can save you the per-file Get Metadata calls: Get Metadata can filter by last modified itself. Set modifiedDatetimeStart and modifiedDatetimeEnd in its store settings, and childItems then returns only the files modified in that range. The filter works only when Get Metadata points at a folder, not a file. Times are UTC, and files in subfolders aren't included.
1. Point Get Metadata at the folder with field list Child items, and set the window. In the activity JSON it sits here:
"storeSettings": {
"type": "SftpReadSettings",
"modifiedDatetimeStart": "@{variables('LastWatermark')}",
"modifiedDatetimeEnd": "@{pipeline().TriggerTime}"
}2. Feed childItems into the ForEach and Copy, so only new files reach the loop.
3. After a fully successful run, store the same TriggerTime as the new watermark. The window is start inclusive and end exclusive, so consecutive runs neither skip nor repeat a file.
4. If you filter in the Copy activity instead, note that the last modified filter is ignored when File path type is List of files.
If a file-level Get Metadata still returns the run time, compare the same file's timestamp in an SFTP client such as WinSCP. Both Get Metadata and the Copy filter read the Last Modified attribute the server reports. If the server doesn't report a real one, neither filter will work, and a log table of processed file names (or a date in the file name) is the fallback.
Note: this filter is documented on the Azure Data Factory Get Metadata page. The Fabric Get Metadata page doesn't mention it, so test it once on a small folder.
If this solves it, please mark it as the solution.
References:
https://learn.microsoft.com/en-us/azure/data-factory/control-flow-get-metadata-activityhttps://learn.microsoft.com/en-us/fabric/data-factory/connector-sftp-copy-activity