I am unable to read the latest file name downloaded from C:\Users\info\Downloads. Please help me
Try with this expression ,
new DirectoryInfo(âyourDirectoryPathâ).GetFiles().OrderByDescending(Function(f) f.LastWriteTime).First().ToString
This will return the latest file name as a string output
Welcome to UiPath community
Try with this expression and update the file format in the expression
Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads").[Select](Function(x) New FileInfo(x)).Where(Function(f) f.Extension.Equals(".xls")).OrderByDescending(Function(x) x.LastWriteTime).Take(1).ToArray()(0).ToString
Regards
Gokul
Great it works. It retrieves the full path, I need only the file name.
You can try with this expression
Path.GetFileNameWithoutExtension(Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)+"\Downloads").[Select](Function(x) New FileInfo(x)).Where(Function(f) f.Extension.Equals(".xlsx")).OrderByDescending(Function(x) x.LastWriteTime).Take(1).ToArray()(0).ToString)
Regards
Gokul
Thank you.
It retrieves the full path, I need only the file name.
WOW, it simply worked. Thanks a lot. You saved my time.
Kindly clsoe this topic by mark as solved. It will help for other too.
Regards
Gokul
I am unable to read the file downloaded from C:\Users\info\Downloads⌠please help me
Thank you for your email. I have clicked âsolvedâ. it was a great help
nithya
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.