检查目录中的文件夹 [英] Check a folder in a directory
本文介绍了检查目录中的文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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
推荐答案
检查一下.
http://www.dotnetspider.com/resources/16119-create-delete-folder.aspx [^ ]
http://msdn.microsoft.com/en-us/library/as2f1fez.aspx [ ^ ]
http://stackoverflow.com/questions/4244446/creating-a-new-folder-and-a-text-file-inside-that-folder [
Check this.
http://www.dotnetspider.com/resources/16119-create-delete-folder.aspx[^]
http://msdn.microsoft.com/en-us/library/as2f1fez.aspx[^]
http://stackoverflow.com/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
这篇关于检查目录中的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文