how can I sort (not filter) directoryinfo files by date (oldest to recent) ? I am using asp.net and visual studio 2008
The same as @DaRKoN_ in vb.net:
Module Module1
Sub Main()
Dim orderedFiles = New System.IO.DirectoryInfo("c:\\").GetFiles().OrderBy(Function(x) x.CreationTime)
For Each f As System.IO.FileInfo In orderedFiles
Console.WriteLine(String.Format("{0,-15} {1,12}", f.Name, f.CreationTime.ToString))
Next
End Sub
End Module
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With