c#实现 文件夹导入和删除

时间:2013-06-08 08:50:59
【文件属性】:

文件名称:c#实现 文件夹导入和删除

文件大小:19KB

文件格式:CS

更新时间:2013-06-08 08:50:59

c实现 文件夹导入和删除

string newstrpath = Application.StartupPath + "\\" + textBox3.Text + textBox1.Text; if (!Directory.Exists(newstrpath)) { System.IO.Directory.CreateDirectory(newstrpath); string oldstrpath = ""; //====================================== FolderBrowserDialog folderdlg = new FolderBrowserDialog(); if (folderdlg.ShowDialog() == DialogResult.OK) oldstrpath = folderdlg.SelectedPath; string srcdir, destdir; bool recursive; recursive = true; if (oldstrpath != "") { srcdir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), oldstrpath); destdir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), newstrpath); FileCopy(srcdir, destdir, recursive); MessageBox.Show("导入完成", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("你还没选择导入的文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { DialogResult dr= MessageBox.Show("这位学生的论文已存在,如果需要改变,先删除!要删除吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dr == DialogResult.Yes) { DeleteFolder(newstrpath); MessageBox.Show("删除成功了", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }


网友评论