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

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'