How to get the path of the latest file from the folder

Ask general questions here.
premravi
Posts: 78
Joined: Tue Jan 08, 2019 1:55 pm

How to get the path of the latest file from the folder

Post by premravi » Thu May 30, 2019 2:35 pm

Hi,

I am trying to get the location of the latest html file from a specific path/folder

Actually everytime after successful run one new html report will generate (NOTE : This HTML report is not Ranorex specific this is custom report)

Basically the requirement is:
I am trying to get the path of that newly generated html file and store it into a variable and I will use that variable to call that to make sure that YES
"File got generated successfully"

So, I am not getting how can I get the path of that file
like say for an instance

C:\Fusion\Results\ResultsSummary_2019.05.28-04.37.47\Results_DetailedReport_2019.05.28-04.37.47.html

Get this path and store it in a variable

Regards

User avatar
Stub
Posts: 266
Joined: Fri Jul 15, 2016 1:35 pm

Re: How to get the path of the latest file from the folder

Post by Stub » Thu May 30, 2019 2:46 pm

I would take a look at System.IO.FileInfo.