Click here to Skip to main content
12,883,114 members (38,049 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#
Hi All,

C# How to get the files from the folder for a particular date range without traversing through the entire folder in Fastest way.

I am having around 1.5 lakhs of files in the folder and my windows application is taking more than 20 minutes to fetch the files for the given date range. Please help me.

Note:Files are coming to the folder at random times.
Thanks In Advance.

Posted 9-Jan-13 0:05am
Updated 9-Jan-13 0:06am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


try it and reply me how much time it takes

var List = new System.IO.DirectoryInfo("[Path]").GetFiles("*.*").Where(p => p.CreationTime > Convert.ToDateTime("25 Jan 2012") && p.CreationTime > Convert.ToDateTime("30 Jan 2012"));

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170422.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100