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



  1. Drag and drop the "Assign" activity and assign the value to the string variable "MostRecentFile" to
  2. (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

  3. Display the value of the "MostRecentFile" variable in the message box
  4. Picture showing the message box activity to display the value of the MostRecentFile variable
    Click to Enlarge

  5. Save and run the bot

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