How to access a file downloaded recently in my system

Hi, I am doing some automation, where an html webpage is getting saved in the system. It is not always going to ‘downloads’ folder. I need to use START PROCESS activity later on to open this webpage. How to mention the path name for this webpage that is getting saved in my system.

I tried to use

Directory.GetFiles(Folder_Path, “*.html”, SearchOption.AllDirectories).OrderByDescending(Function(x) New FileInfo(x).CreationTime).Take(1)

to get the recent file (where Folder_Path is DOWNLOADS folder, assuming if system starts from scratch, file will be downloaded there only), but not sure how to use this IEnumerable type variable in START PROCESS activity.

Any help would be appreciated.
Thanks

Hi @aishwarya.gupta

You just missed .First.ToString at the end of your mentioned code, Find the updated one below. Assign this to String variable and use it in start process

Directory.GetFiles(“C:\Users\Vishal\Downloads”, “*.html”, SearchOption.AllDirectories).OrderByDescending(Function(x) New FileInfo(x).CreationTime).Take(1).First.ToString

Thats it

2 Likes

Bingo. That worked. Thank you !!! :slight_smile:

1 Like

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