【发布时间】:2019-06-18 07:41:54
【问题描述】:
我尝试从目录符号链接中获取路径列表。这是写异常
找不到路径的一部分。
var filePath = @"C:\symlink";
var paths = new List<string>((Directory
.GetFiles(filePath, "*.*", SearchOption.AllDirectories))
.OrderBy(x => new FileInfo(x).Name));
【问题讨论】:
-
检查目录是否存在:
if (Directory.Exists(filePath)) {...} -
输入到:if (Directory.Exists(filePath))