本文介绍了如何在运行时重命名文件夹。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 //我有文件夹GallaryFolder-> AlbumFolder-> ImagesFolder->图像文件 //并使用此代码重命名文件夹 //i have folders GallaryFolder->AlbumFolder->ImagesFolder->Images Files//and have used this code for rename the folder DirectoryInfo imageFolder = new DirectoryInfo(Server.MapPath("~/Gallary/") + str + "/Images/"); string Imgpath = "~/Gallary/" + str + "/Images/"; bool isImg = System.IO.Directory.Exists(Server.MapPath(Imgpath)); if (isImg==true) { DirectoryInfo newimageFolder = new DirectoryInfo(Server.MapPath("~/Gallary/") + txtname.Text + "/Images/{0}"); string newImgpath = "~/Gallary/" + txtname.Text + "/Images/"; bool isnewImg = System.IO.Directory.Exists(Server.MapPath(newImgpath)); if (!isnewImg) { newimageFolder.Create(); Directory.Move(Imgpath, newImgpath); xmldoc.Save(Server.MapPath("~/" + "XML/album.xml")); } } //但只有GallaryFolder-> AlbumFolder-> ImagesFolder它被复制图像文件未被复制。 你能告诉我我哪里出错。//but only GallaryFolder->AlbumFolder->ImagesFolder it is getting copied images files are not getting copied. can you please tell me where i am going wrong.推荐答案 请看下面的链接: Server.MapPath(。),Server.MapPath( 〜),Server.MapPath(@\), Server.MapPath(/)。有什么区别? [ ^ ] 用C#重命名文件 [ ^ ] Please have a look on the bellow link :Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\"), Server.MapPath("/"). What is the difference?[^]Rename a file in C#[^] 这篇关于如何在运行时重命名文件夹。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 09-19 04:35