I am currently using the below .net code to retrieve the last modified file:
new DirectoryInfo(Path).GetFiles().OrderByDescending(Function(f) f.LastWriteTime).First().ToString
However there needs to be a extra validation to exclude the file name “summary.pdf” even if its the latest and consider only the remaining files names .
Could you please help on how to get the most recent file in a directly excluding a specific file name?
new DirectoryInfo(Path).GetFiles().OrderByDescending(Function(f) f.LastWriteTime).Select(Function(x)Not(x.Name.ToLower.Equals(“summary.pdf”))).First().ToString
@vipin.jacop My Apologies , This seems to be the right Expression :
new DirectoryInfo(Path).GetFiles().OrderByDescending(Function(f) f.LastWriteTime).Where(Function(x)Not(x.Name.ToLower.Equals(“summary.pdf”))).First().ToString