Reputation: 123
Scenario: Need to know the filename which was copied from source to destination using copy activity of azure data factory.
Problem : Get metadata can be used for getting the file name. But how do we know which file is copied if more then one file is present in the folder.
Upvotes: 2
Views: 1266
Reputation: 4925
You need to follow the below process in case if you want to achieve the requirement via in built ADF activities else it can be easily achieved by python(Azure functions) or csutom activity.
Create 2 variables : MaxLastProcessedDate = 1900-01-01 LatestFile
Use GetMetaDataActivity at folder level to get the list of childItems
Use the output of the childitems field as input to a foreach loop activity
Within Foreach :
a) GetMetaDataActivity at file level (since each iteration would be for each file)
b) If condition activity (if lastmodifieddate of getmetadata activity > MaxLastProcessedDate)
for true: update the MaxLastProcessedDate variable to the lastmodifieddate of getmetadata activity and update the LatestFile variable to file name of that iteration.
Upvotes: 0
Reputation: 8660
Maybe you can try to filter by last modified time. Start time use this expression:
@activity('Copy data1').output.executionDetails[0].start
End time use @utcnow()
Upvotes: 1