Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

--
Prashant
Posted
Updated 9-Jan-13 0:06am
v2

1 solution

Hi,

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"));
 
Share this answer
 
v2

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900