FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "请选择文件路径";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
if (string.IsNullOrEmpty(dialog.SelectedPath))
{
System.Windows.MessageBox.Show(this, "文件夹路径不能为空", "提示");
return;
}
textBox4.Text = dialog.SelectedPath;
DirectoryInfo directory = new DirectoryInfo(textBox4.Text); FileInfo[] filelist = directory.GetFiles("*", SearchOption.AllDirectories);