Hi All,
I need to get latest text file from folder how to do that please some one help me
Regards,
Hima
Hi All,
I need to get latest text file from folder how to do that please some one help me
Regards,
Hima
Try with this,
new DirectoryInfo("yourDirectoryPath").GetFiles().OrderByDescending(Function(f) f.LastWriteTime).First().ToString
This will return the latest file name as a string output
Its giving me first file but i want latest one
this expression would get you the latest file
str_filepath = Directory.GetFiles(yourfolder_path,“*.txt”).OrderByDescending(Function(d) New FileInfo(d).CreationTime).Tolist(0)
Cheers @thima
Which query you are referring here?
Is this the one?
new DirectoryInfo("yourDirectoryPath").GetFiles().OrderByDescending(Function(f) f.LastWriteTime).First().ToString
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.