i have a requirement to get the last created directory in a path with respect to its name, as an application i use created 2 directories during the runtime and i need to consider only one of them, which in order appears later. For e.g the app creates 2 folders with name: 60000c and b3c143 and i need the one with the name "b3c143". How can i acheive this? Thanks. I get the latest one using the code:
string path = @"C:\temp";
string mostRecentlyModified = Directory.GetDirectories(path)
.Select(f => new FileInfo(f))
.OrderByDescending(fi => fi.LastAccessTime)
.First()
.FullName;