Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
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
Posted
Updated 7-Aug-12 7:28am
v3

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



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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900