DirectoryInfo theFolder = new DirectoryInfo(path);
DirectoryInfo[] dirInfo = theFolder.GetDirectories();
List<string> filelist = new List<string>();
//遍历文件夹
foreach (DirectoryInfo NextFolder in dirInfo)
{
// this.listBox1.Items.Add(NextFolder.Name);
FileInfo[] fileInfo = NextFolder.GetFiles();
foreach (FileInfo NextFile in fileInfo) //遍历文件
{
filelist.Add(NextFile.Name);
}
}