Directory.GetFiles get today's files only

.net, asp.net, c#

Solution

Try this:

var todayFiles = Directory.GetFiles("path_to_directory")
                 .Where(x => new FileInfo(x).CreationTime.Date == DateTime.Today.Date);

Problem

There is nice function in .NET Directory.GetFiles, it's simple to use it when I need to get all files from directory. ``` Directory.GetFiles("c:\\Files") ``` But how (what pattern) can I use to get only files that created time have today if there are a lot of files with different created time? Thanks!

Original source

Related problems