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