Click here to Skip to main content
Rate this: bad
good
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.
 
--
Prashant
Posted 9-Jan-13 0:05am
Edited 9-Jan-13 0:06am
v2

1 solution

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

Solution 1

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"));
  Permalink  
v2

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

  Print Answers RSS
0 Nirav Prabtani 268
1 OriginalGriff 217
2 Mika Wendelius 185
3 CPallini 170
4 _Amy 170
0 Nirav Prabtani 284
1 OriginalGriff 217
2 Mika Wendelius 185
3 _Amy 170
4 Sergey Alexandrovich Kryukov 154


Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 9 Jan 2013
Copyright © CodeProject, 1999-2014
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