在目录中搜索大量文件?

时间:2022-08-02 22:09:35

I'm using MSVE, and I have my own tiles I'm displaying in layers on top. Problem is, there's a ton of them, and they're on a network server. In certain directories, there are something on the order of 30,000+ files. Initially I called Directory.GetFiles, but once I started testing in a pseudo-real environment, it timed out.

我正在使用MSVE,我有自己的瓷砖,我在顶层显示。问题是,有大量的,他们在网络服务器上。在某些目录中,有大约30,000多个文件。最初我调用了Directory.GetFiles,但是一旦我开始在伪实际环境中进行测试,它就会超时。

What's the best way to programatically list, and iterate through, this many files?

以编程方式列出并遍历这么多文件的最佳方法是什么?

Edit: My coworker suggested using the MS indexing service. Has anyone tried this approach, and (how) has it worked?

编辑:我的同事建议使用MS索引服务。有没有人尝试过这种方法,并且(如何)有效?

5 个解决方案

#1


4  

I've worked on a SAN system in the past with telephony audio recordings which had issues with numbers of files in a single folder - that system became unusable somewhere near 5,000 (on Windows 2000 Advanced Server with an application in C#.Net 1.1)- the only sensible solution that we came up with was to change the folder structure so that there were a more reasonable number of files. Interestingly Explorer would also time out!

我过去曾在一个SAN系统上使用电话音频录音,这个录音存在单个文件夹中的文件数量问题 - 该系统在5,000附近变得无法使用(在带有C#.Net 1.1的应用程序的Windows 2000 Advanced Server上) - 我们提出的唯一明智的解决方案是更改文件夹结构,以便有更合理数量的文件。有趣的是,Explorer也会超时!

The convention we came up with was a structure that broke the structure up in years, months and days - but that will depend upon your system and whether you can control the directory structure...

我们提出的惯例是一个在数年,数月和数天内破坏结构的结构 - 但这取决于您的系统以及您是否可以控制目录结构......

#2


2  

Definitely split them up. That said, stay as far away from the Indexing Service as you can.

绝对将它们分开。也就是说,尽可能远离索引服务。

#3


1  

None. .NET relies on underlying Windows API calls that really, really hate that amount of files themselves.

没有。 .NET依赖于底层的Windows API调用,这些调用确实非常讨厌那些文件本身。

As Ronnie says: split them up.

罗尼说:把它们分开。

#4


1  

You could use DOS?

你可以使用DOS吗?

DIR /s/b > Files.txt

#5


1  

You could also look at either indexing the files yourself, or getting a third part app like google desktop or copernic to do it and then interface with their index. I know copernic has an API that you can use to search for any file in their index and it also supports mapping network drives.

您还可以查看自己索引文件,或者获取第三方应用程序(如google desktop或copernic)来执行此操作,然后与其索引进行交互。我知道copernic有一个API,您可以使用它来搜索索引中的任何文件,它还支持映射网络驱动器。

#1


4  

I've worked on a SAN system in the past with telephony audio recordings which had issues with numbers of files in a single folder - that system became unusable somewhere near 5,000 (on Windows 2000 Advanced Server with an application in C#.Net 1.1)- the only sensible solution that we came up with was to change the folder structure so that there were a more reasonable number of files. Interestingly Explorer would also time out!

我过去曾在一个SAN系统上使用电话音频录音,这个录音存在单个文件夹中的文件数量问题 - 该系统在5,000附近变得无法使用(在带有C#.Net 1.1的应用程序的Windows 2000 Advanced Server上) - 我们提出的唯一明智的解决方案是更改文件夹结构,以便有更合理数量的文件。有趣的是,Explorer也会超时!

The convention we came up with was a structure that broke the structure up in years, months and days - but that will depend upon your system and whether you can control the directory structure...

我们提出的惯例是一个在数年,数月和数天内破坏结构的结构 - 但这取决于您的系统以及您是否可以控制目录结构......

#2


2  

Definitely split them up. That said, stay as far away from the Indexing Service as you can.

绝对将它们分开。也就是说,尽可能远离索引服务。

#3


1  

None. .NET relies on underlying Windows API calls that really, really hate that amount of files themselves.

没有。 .NET依赖于底层的Windows API调用,这些调用确实非常讨厌那些文件本身。

As Ronnie says: split them up.

罗尼说:把它们分开。

#4


1  

You could use DOS?

你可以使用DOS吗?

DIR /s/b > Files.txt

#5


1  

You could also look at either indexing the files yourself, or getting a third part app like google desktop or copernic to do it and then interface with their index. I know copernic has an API that you can use to search for any file in their index and it also supports mapping network drives.

您还可以查看自己索引文件,或者获取第三方应用程序(如google desktop或copernic)来执行此操作,然后与其索引进行交互。我知道copernic有一个API,您可以使用它来搜索索引中的任何文件,它还支持映射网络驱动器。