How to get a specific and most recent file from a directory

Hello,

I am trying to get this most recent “List” file in this directory, and it appears that UiPath isn’t allowing wildcards in my file name.

Based on the screen print, I want to get THIS specific “list_p00028832vja_ *” I am unable to name a specific file because as you can see that last segment in the string is a date variable.

https://www.google.com/search?q=uipath+directory.getfiles+site:forum.uipath.com&safe=active&rlz=1C1GCEA_enUS956US956&sa=X&ved=2ahUKEwj2_piOluz3AhUDTt8KHWvsDpEQrQIoBHoECAkQBQ&biw=1920&bih=977&dpr=1

@pincioc

Can you try the below expression:

str_filepath = Directory.GetFiles(yourfolder_path,“list_p00028832vja_*”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.