Directory.GetFiles in date order
how go getfiles or getsystemfile in date order? need other methods, or need set something?
thanks,
jon jacobs
message composed entirely recycled electrons.
this should work, though when tested .txt files creation date became creation date of folder in. if created a word document, creation date correct , code worked.
class program
{
static void main(string[] args)
{
directoryinfo dirinfo = new directoryinfo(@"c:\test\");
var filesinorder = f in dirinfo.enumeratefiles()
orderby f.creationtime
select f;
foreach (var item in filesinorder)
{
console.writeline(item.name);
}
console.readkey();
}
}
bob - www.crowcoder.com
Visual Studio Languages , .NET Framework > Visual C#
Comments
Post a Comment