Articles → UIPATH → Find the latest modified file in a single directory in UiPath

Find the latest modified file in a single directory in UiPath






Example




Picture showing list of files in the folder

Click to Enlarge





(new DirectoryInfo("C:\temp\Articles")).GetFiles().OrderByDescending(function(x) x.LastWriteTimeUtc).FirstOrDefault().FullName


Picture showing the Assign activity to assign the value of most recent file name to the MostRecentFile variable

Click to Enlarge



Picture showing the message box activity to display the value of the MostRecentFile variable

Click to Enlarge




Output


Picture showing the message box with the value of the most recent file name

Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, March 12, 2021

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250