Answers for "asp.net get most recent file in directory"

C#
0

asp.net get most recent file in directory

var directory = new DirectoryInfo("C:\\MyDirectory");
var myFile = (from f in directory.GetFiles()
             orderby f.LastWriteTime descending
             select f).First();

// or...
var myFile = directory.GetFiles()
             .OrderByDescending(f => f.LastWriteTime)
             .First();
Posted by: Guest on October-04-2021

Code answers related to "asp.net get most recent file in directory"

C# Answers by Framework

Browse Popular Code Answers by Language