C# 遍历文件夹

C#遍历浏览某个文件夹下的所有文件,方法如下:

 

 1 //C#遍历指定文件夹中的所有文件 
 2             DirectoryInfo TheFolder = new DirectoryInfo(path);
 3             if (!TheFolder.Exists)
 4                 return;
 5 
 6             //遍历文件
 7             foreach (FileInfo NextFile in TheFolder.GetFiles())
 8             {
 9                 if (NextFile.Name == "0-0-11.grid")
10                     continue;
11           // 获取文件完整路径 12 string heatmappath = NextFile.FullName;

}

 

posted @ 2019-06-12 14:16  码农拔萝卜  阅读(11001)  评论(0编辑  收藏  举报