遍历文件夹下的文件,并且获取文件名字
string x = txtpath.Text;
DirectoryInfo theFolder = new DirectoryInfo(x);
FileInfo[] fileInfo = theFolder.GetFiles();
foreach (FileInfo NextFile in fileInfo) //遍历文件
{
var filename = NextFile.Name;
}