My Output file name looks like Output_yyyy_MM_dd_hh_mm_ss. And suppose if i have below files in the folder and my current day is October 28th 2021. I want the Current Days file which is latest. I have tried the below expression but it only looks latest file considering the creation time. I also want to consider the Current Day in below expression. Can you anyone help me with this? I am considering this case because there might be a day where an output file for that particular day might not be there/generated in the folder and it will take latest file considering the creation date from the below expression which is wrong.
str_filepath = Directory.GetFiles(yourfolder_path,“*.xlsx”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)
I don’t want to compare all the files in the folder. I just want to using something like DateTime.Now and get latest file for the Current Day considering with creation time.Can you help me with expression/syntax for this