Hero is coming back

风吹呀吹

风会指引你前进的方向

C# 遍历制定目录下所有文件

using System.Net;

 

 public void FindFile(string dirPath) //参数dirPath为指定的目录
        {

            DirectoryInfo Dir = new DirectoryInfo(dirPath);
            foreach (DirectoryInfo d in Dir.GetDirectories())
            {
                FindFile(Dir + @"\" + d.ToString() );
            }
            foreach (FileInfo f in Dir.GetFiles("*.html")) //查找文件
            {
                string fullName = f.FullName;
                string getPath = f.DirectoryName;
            }
        }

 

posted @ 2017-11-15 14:29  风吹呀吹  阅读(263)  评论(0编辑  收藏  举报