var files = Directory.GetFiles(@"C:\", "*.*",SearchOption.AllDirectories); // 遍历所有文件 var dirs= Directory.GetDirectories(@"C:\", "*", SearchOption.AllDirectories); //遍历所有文件夹
DirectoryInfo TheFolder = new DirectoryInfo(path); if (!TheFolder.Exists) return; //遍历文件 foreach (FileInfo NextFile in TheFolder.GetFiles()) { // 获取文件完整路径 string heatmappath = NextFile.FullName; }