How to: Create a File or Folder – C#
filed in C# on Feb.01, 2010
This example creates a folder and a subfolder on a computer.
// Specify a "currently active folder"
string activeDir = @"c:\testdir2";
//Create a new subfolder under the current active folder
string filePath = System.IO.Path.Combine(activeDir, "mySubDir");
// Create the subfolder
if (!System.IO.Directory.Exists(filePath)) {
//Create directory
System.IO.Directory.CreateDirectory(filePath);
}
For more info see: http://msdn.microsoft.com/en-us/library/as2f1fez.aspx
Leave a Reply