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 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; }