当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > 文件搜索的实现(深度搜索)

ASP.NET
在word中如何控制graph控件
把一个int数组的数字从小到大排列(C#)
Asp组件高级入门与精通系列之三
连接MYSQL数据库的方法及示例
SharePoint Portal Server之常见问题
软件开发中运用到的编号
VB程序员眼中的C#7
公农历转换VB类
VB程序员眼中的C#6
优化VB.NET应用程序的性能1
C#初学乍练-文本替换工具命令行版
如何得到某集合的所有子集合
VB程序员眼中的C#3
Shared Source CLI Essentials第一章第二部分
在ASP.NET使用javascript的一点小技巧
用户 'NT AUTHORITY\NETWORK SERVICE' 登录失败解决方法
开始使用SQLServer2005,没用过MSDE,一开始还不知道怎么下手呢,呵呵
我的ASP.net学习历程有关于.dll文件的迷惑
在图片上写字 C#
Shared Source CLI Essentials第一章第一部分

ASP.NET 中的 文件搜索的实现(深度搜索)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 101 ::
收藏到网摘: n/a

System.Collections.Stack stackFile = new Stack(); /// /// 把要搜索的路径的文件夹全部压栈 /// /// public Stack FileList(string path) { string[] files = System.IO.Directory.GetDirectories(path); foreach(string file in files) { stackFile.Push(file); FileList(file); } return stackFile; } /// /// 把所有符合搜索条件的文件放到一个ArrayList里 /// /// 搜索的路径 /// 要搜索的文件 /// public ArrayList SearchFile(string path,string filter) { ArrayList array = new ArrayList(); Stack stack = new Stack(); //-----------对根目录进行搜索 string[] Rootfiles = System.IO.Directory.GetFileSystemEntries(path,filter); foreach(string file in Rootfiles) { System.IO.DirectoryInfo dirInfo = new DirectoryInfo(file); array.Add(dirInfo); } //----------- stack = this.FileList(path); if(stack.Count > 0) { while(stack.Count > 0) { string CurrentFile = stack.Pop().ToString(); string[] files = System.IO.Directory.GetFileSystemEntries(CurrentFile,filter); foreach(string file in files) { System.IO.DirectoryInfo dirInfo = new DirectoryInfo(file); array.Add(dirInfo); } } } return array; }