i dont want UiPath to specifically click on a specific file, i want it to click on any recent file that has has just been downloaded. how do i do that?
This is not a best practice to click on the recent downloaded file. Instead of that you can use the expression to get the recently downloaded file path in a folder.
Check the below expression which will give the recently downloaded file path in downloaded folder,
System.IO.Directory.GetFiles("Download Folder Path").OrderBy(Function(file) New FileInfo(file).CreationTime).LastOrDefault()
In the above expression change the path of the download folder.
Hope it helps!!
what activity would i have to use to input the path?
You have to use the assign activity only, Take an assign activity and create a variable called DownladedFile which is in String datatype… @Gwendolyn_Toh_JiaHui
- Assign -> DownladedFile = System.IO.Directory.GetFiles("Download Folder Path").OrderBy(Function(file) New FileInfo(file).CreationTime).LastOrDefault()
In the DownloadedFile variable newly downloaded filepath stored and you can use the variable for the further Process.
Hope you understand!!
Try below Expression in Assign Activity:
System.IO.Directory.GetFiles("FolderPathToCheck").OrderBy(Function(x) New FileInfo(x).CreationTime).LastOrDefault
Hope it will helps you
Cheers!!
Hi,
First get the latest file name from folder using below syntax:-
Assign activity -
System.IO.Directory.GetFiles(“FolderPathToCheck”).OrderBy(Function(x) New FileInfo(x).CreationTime).LastOrDefault
Then click activity selector, pass the file name in aa name.
Thanks
Try with wait for download activity.
It will directly download the file and specify the path and name of the file you need that downloaded file to be saved as.