>>Hi All,
>>
>>I am looking for the quickest way to get the name of the oldes file of a specific pattern in a given directory. I can loop through the results of Directory.GetFiles() but wondering if there is a more efficient way.
>>Thanks
>>Tim
>
>If you can use Linq/lambas, you can do something like this:
>
>
>System.IO.DirectoryInfo info = new System.IO.DirectoryInfo(@"C:\");
>System.IO.FileInfo[] files = info.GetFiles("*.jpg");
>List<System.IO.FileInfo> sortedFiles = files.OrderBy(x => x.CreationTime).ToList();
>
>
>I don't know that internally it's any more efficient than looping, but it's definitely simple.
---------------------------------------------------
going for the cool points!