////// 创建文件夹 /// /// /// protected void Button1_Click(object sender, EventArgs e) { if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } } ////// 删除文件夹 /// /// /// protected void Button2_Click(object sender, EventArgs e) { if (Directory.Exists(path)) { Directory.Delete(path); } } ////// 移动文件夹 /// /// /// protected void Button3_Click(object sender, EventArgs e) { Directory.Move(path, newpath); } ////// 创建文件 /// /// /// protected void Button4_Click(object sender, EventArgs e) { if (!File.Exists(newpath + @"\myfile.txt")) { File.CreateText(newpath + @"\myfile.txt"); } Response.Write(String.Format("The number of files in {0} is {1}", newpath, Directory.GetFiles(newpath).Length)); } ////// 删除文件 /// /// /// protected void Button5_Click(object sender, EventArgs e) { if (File.Exists(newpath + @"\myfile.txt")) { File.Delete(newpath + @"\myfile.txt"); } } ////// 移动文件 /// /// /// protected void Button6_Click(object sender, EventArgs e) { File.Move(newpath + @"\myfile.txt", path + @"\file.txt"); }