如何使用asp.net和c#在驱动器中搜索文件

本文关键字:驱动器 搜索 文件 何使用 asp net | 更新日期: 2023-09-27 18:05:46

在我的Asp.net和c# web应用程序中,我想在硬盘驱动器中搜索具有文件名或通配符的文件(例如C:'),并在树视图中显示结果。如何做到这一点呢?

如何使用asp.net和c#在驱动器中搜索文件

试试这个:

DirectoryInfo folder = new DirectoryInfo(@"C:'Examples");
FileInfo[] files = folder.GetFiles("MyFile*.txt", SearchOption.AllDirectories);