Get Last Modified Time of a file in a folder into a DateTime variable

activities
studio

#1

I’m looping through every file in a folder with a For Each activity to perform some actions on each file. And I’ve done that step.

Then I want to get the Date Modified feature of each file within the For Each, and pass that into a DateTime variable.

I saw something might be similar in the following link but I still don’t know how to pass Date Modified of a file into a variable.

https://forum.uipath.com/t/find-latest-file-in-a-folder-with-respect-to-date-created/2528

Please advice how to use function(file) …and store that in a variable


#2

assign DateTime modification = IO.File.GetLastWriteTime(“C:\test.txt”)

Change “C:\test.txt” to your filepath from for each


#3

@SybilWang check attached zip file

ReadFiles - LastDate.zip (393.0 KB)