如何在运行时重命名文件夹。

编程入门 行业动态 更新时间:2024-10-27 15:17:57
本文介绍了如何在运行时重命名文件夹。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

//我有文件夹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#[^]

更多推荐

如何在运行时重命名文件夹。

本文发布于:2023-11-13 09:16:55,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1583985.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件夹   重命名   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!