检查目录中的文件夹

编程入门 行业动态 更新时间:2024-10-28 08:17:23
本文介绍了检查目录中的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

string activefolder = @"E:\Mahesh.Project\Database_img\"; bool IsExits = System.IO.Directory.Exists(Server.MapPath(activefolder)); if(IsExits) { string subdirtive = System.IO.Path.ChangeExtension(activefolder, Albumname_txt.Text); System.IO.Directory.CreateDirectory(MapPath(subdirtive)); } else { result.Text = "Folder Already Exist"; Albumname_txt.Text = ""; } //Create a new subfolder under the current active folder //string subdirtive = System.IO.Path.ChangeExtension(activefolder, Albumname_txt.Text); //System.IO.Directory.CreateDirectory(subdirtive);// Create the subfolder

我的代码就是这种方式…… 例如,我有一个文本框,其中输入了文件夹名称.使用该文件夹名称,必须在指定目录中创建一个文件夹... 而且我必须验证是否创建了相同的名称文件夹 我想要一些示例代码片段,请问有人可以帮我吗

My code is in this way...... For example i have a textbox in that i entering a folder name. With that folder name a folder must create in a specified directory ... And i have to validate same name folder is created I want some sample snippet ,,can any one help me out

推荐答案

检查一下. www.dotnetspider/resources/16119-create-delete-folder.aspx [^ ] msdn.microsoft/en-us/library/as2f1fez.aspx [ ^ ] stackoverflow/questions/4244446/creating-a-new-folder-and-a-text-file-inside-that-folder [ ^ ] Check this. www.dotnetspider/resources/16119-create-delete-folder.aspx[^] msdn.microsoft/en-us/library/as2f1fez.aspx[^] stackoverflow/questions/4244446/creating-a-new-folder-and-a-text-file-inside-that-folder[^]

if (Directory.Exists(Application.StartupPath + @"\DownloadedFile\'" + DBName + "'" + '\\' + "GetUserDispute") == false) { DirectoryInfo directyinfo = new DirectoryInfo(Application.StartupPath + @"\DownloadedFile\'" + DBName + "'" + '\\' + "GetUserDispute"); directyinfo.Create(); }

通过DirectoryInfo类,您可以在所需路径旁边创建文件夹

Through DirectoryInfo Class you can create the folder in side your required path

更多推荐

检查目录中的文件夹

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

发布评论

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

>www.elefans.com

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