How to Open a Directory Sorted by Date?

General software, Operating Systems, and Programming discussion.
Everything from software questions, OSes, simple HTML to scripting languages, Perl, PHP, Python, MySQL, VB, C++ etc.
Post Reply
User avatar
complete
Member
Posts: 75
Joined: Fri Aug 26, 2005 11:08 am

How to Open a Directory Sorted by Date?

Post by complete »

How to Open a Directory Sorted by Date?

In C#, I can open a directory for reading each file. How to I make sure that the directory I investigate in my C# code is opened such that it is sorted by last modified date?
rapidfirerocks
New Member
Posts: 1
Joined: Sun Jul 24, 2022 6:46 pm
Location: Scotland

Post by rapidfirerocks »

it was this that brought me to speedguide so only fitting I drop the answer...

DirectoryInfo info = new DirectoryInfo("DIRECTORY_PATH");
FileInfo[] files = info.GetFiles().OrderBy(p => p.CreationTime).ToArray();

:)
Post Reply