Click here to Skip to main content
Rate this: bad
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 1:05am
Edited 9-Jan-13 1: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
0 OriginalGriff 476
1 Sergey Alexandrovich Kryukov 215
2 CHill60 195
3 Afzaal Ahmad Zeeshan 145
4 TheRealSteveJudge 120
0 Sergey Alexandrovich Kryukov 9,061
1 OriginalGriff 7,920
2 Peter Leow 4,774
3 Kornfeld Eliyahu Peter 3,210
4 Maciej Los 2,176

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