What you want to use is the
DirectoryInfo
object and the
GetFiles
method.
string userInputPath = string.Empty;
string fileType = string.Empty;
System.IO.DirectoryInfo dInfo = new System.IO.DirectoryInfo(userInputPath);
var files = dInfo.GetFiles(fileType, System.IO.SearchOption.AllDirectories);
Here is the reference on
MSDN[
^]. It is pretty straight forward.