Directory.GetFiles get today's files only

前端 未结 7 641
青春惊慌失措
青春惊慌失措 2021-01-04 01:02

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\")
<         


        
7条回答
  •  被撕碎了的回忆
    2021-01-04 01:35

    Try this:

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

提交回复
热议问题