/// <summary>
/// 递归搜索文件夹下的文件
/// </summary>
/// <param name="dir">文件夹路径</param>
private void GetAll(DirectoryInfo dir)
{
FileInfo[] allFile = dir.GetFiles();
foreach (FileInfo fi in allFile)
{
if (Path.GetExtension(fi.Name) == ".xls")//遍历文件后缀为.xls的文件
{
FindWord(fi.FullName);
}
}
DirectoryInfo[] allDir = dir.GetDirectories();
foreach (DirectoryInfo d in allDir)
{
GetAll(d);
}
}
转载于:https://www.cnblogs.com/contain/archive/2013/04/17/3026766.html