C#递归遍历文件夹

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

    List<FileInfo> list = new List<FileInfo>();  
     public void FindFile(string path, string filePattern)  
            {  
                DirectoryInfo di = new DirectoryInfo(path);  
                FileInfo[] fis = di.GetFiles(filePattern);  
                DirectoryInfo[] dis = di.GetDirectories();  
      
                foreach (FileInfo i in fis)  
                {  
                    list.Add(i);  
                }  
      
                foreach (DirectoryInfo i in dis)  
                {  
                    path = i.FullName;  
                    FindFile(path, filePattern);  
                }  
            }