c#遍历查找指定文件
private Regex nameRx = new Regex(@"([\w\W]*?).(doc|docx)",RegexOptions.IgnoreCase);
private void FildDoc(string path)
{
DirectoryInfo directory = new DirectoryInfo(path);
FileSystemInfo[] fileSystemInfos = directory.GetFileSystemInfos();
foreach (FileSystemInfo filess in fileSystemInfos)
{
if (fileSystemInfo is DirectoryInfo)
{
FildDoc( path);
}
else if (fileSystemInfo is FileInfo)
{
string fileName = fileInfo.Name;
if (nameRx.Match(fileName).Success)
{
//找到word文档了;
}
}
}
}