从目录中获取文件 [英] Get Files From Directory

查看:77
本文介绍了从目录中获取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



C#如何从文件夹中获取特定日期范围的文件,而无需以最快的方式遍历整个文件夹。



我在文件夹中有大约150万个文件,我的Windows应用程序花了超过20分钟来获取给定日期范围内的文件。请帮帮我。



注意:文件随机出现在文件夹中。

先谢谢。



-

Prashant

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

推荐答案





尝试并回复我需要多长时间



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


这篇关于从目录中获取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆