|
try { if (!Directory.Exists(DirectoryTextBox.Text)) { MsgLabel.Text = "该文件不存在"; FileListBox.Visible = false; return; } else { DirectoryInfo dirinfo = new DirectoryInfo(DirectoryTextBox.Text); FileSystemInfo[] dirs = dirinfo.GetFileSystemInfos(); if (dirs.Length < 1) { MsgLabel.Text = "该文件夹为空!"; FileListBox.Visible = false; } else { MsgLabel.Text = "该文件夹包含的文件和目录列表如下:"; FileListBox.Visible = true; FileListBox.DataSource = dirs; FileListBox.DataBind(); } } } catch (Exception ee) { MsgLabel.Text = "操作失败! 失败的原因是:" + ee.ToString(); }
共2页: 上一页 [1] 2 下一页
|