【发布时间】:2011-10-23 01:32:33
【问题描述】:
我正在尝试通过输入文件名或文件内容来搜索扩展名为 .dcm 的文件。我可以在目录中搜索,但是当我尝试在驱动器中搜索时,我收到一个错误,提示缺少目录或汇编引用。
string startFolder = @"C:\";
// Take a snapshot of the file system.
System.IO.DriveInfo dir = new System.IO.DriveInfo(startFolder);
// This method assumes that the application has discovery permissions
// for all folders under the specified path.
IEnumerable<System.IO.FileInfo> fileList = dir.GetFiles("*.*", System.IO.
SearchOption.
AllDirectories);
【问题讨论】:
-
只想指出,由于您正在搜索
*.dcm文件,您可以将searchPattern更改为"*.dcm"而不是"*.*"
标签: c# visual-studio-2008 search directory