user339160
user339160

Reputation:

How to Search for a file in the drive with asp.net and C#

In my Asp.net and C# web application ,i want to search for a file with file name or a wildcard in the hard drive (say C:\ for example) and display the results in a tree view.How can we achieve this ?

Upvotes: 0

Views: 3219

Answers (1)

Tu Tran
Tu Tran

Reputation: 1977

Try this:

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

Upvotes: 1

Related Questions