directory = new System.IO.DirectoryInfo("YourDirectory") myFile = (from f in directory.GetFiles() order by f.LastWriteTime descending select f).First()
Create two variables, directory (Ssystem.IO.DirectoryInfo) and myFile (String)
And use assign activities for the two lines given above.
Thank you so much !
Could you write it on Uipath ?
Thanks a lot !
Please find the attached workflow.
One doubt. You said myFile is of type string and tried the same but it is giving error like ‘Value of type System.IO.FileInfo can’t be converted to string’. So I changed it to System.IO.FileInfo variable then it is working. Is it correct right ?
ReadLastFile.xaml (6.8 KB)
Yes. You are right. Thank you.
To get the full path of the file, we can use the below one instead of one more assign activity -
(from f in directory.GetFiles() order by f.LastWriteTime descending select f).First().ToString
I missed .ToString part.