how to create directory folder in csharp

Code Example - how to create directory folder in csharp

                
                        string subPath ="ImagesPath"; // Your code goes here

bool exists = System.IO.Directory.Exists(Server.MapPath(subPath));

if(!exists)
    System.IO.Directory.CreateDirectory(Server.MapPath(subPath));
                    
                
 

file.create folder csharp

                        
                                Using System.IO; 

//gets the directory where the program is launched from and adds the foldername
string path = Path.Combine(Environment.CurrentDirectory, "foldername");

//Creates a directory(folder) if it doesen't exist
Directory.CreateDirectory(path);
                            
                        
 

Related code examples