C# 浏览文件夹、获得文件夹及子目录下的所有文件

来源:互联网 发布:java loader 编辑:程序博客网 时间:2024/06/07 07:46
            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);


 
阅读全文
0 0
原创粉丝点击