Create a folder by using C#
-
How do we create a folder by using C#? For example , suppose if we want to create a new folder means , Right click --> New Folder. The same way I want to create a New folder dynamically
-
How do we create a folder by using C#? For example , suppose if we want to create a new folder means , Right click --> New Folder. The same way I want to create a New folder dynamically
-
How do we create a folder by using C#? For example , suppose if we want to create a new folder means , Right click --> New Folder. The same way I want to create a New folder dynamically
hi, use following statement DirectoryInfo obDir = new DirectoryInfo(MainDataDirectoryPath); obDir.Create(); hope this helps
Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)
-
How do we create a folder by using C#? For example , suppose if we want to create a new folder means , Right click --> New Folder. The same way I want to create a New folder dynamically
It's just System.IO.Directory.CreateDirectory(@"c:\my directory"); no need to set the current directory ( which is a bad thing to do anyhow, as it can stop the other code from working )
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
How do we create a folder by using C#? For example , suppose if we want to create a new folder means , Right click --> New Folder. The same way I want to create a New folder dynamically
Please - test to see if the directory exists before you attempt to create it:
if (!Directory.Exists(@"c:\foobar")) Directory.CreateDirectory(@"c:\foobar");
Under certain circumstances, you might still get directory name collisions, but with this method you've at least got a fighting chance.
Deja View - the feeling that you've seen this post before.