Create a new directory – Csharp Tutorial
Creating a new directory is very simple using Csharp. The following statement will create a new directory placed in the path C:\directory\subdirectory\. If the directory already exists with files in it, it will not be deleted and the files will not be removed.
System.IO.Directory.CreateDirectory("C:\directory\subdirectory\newdirectory);
using System;
namespace Tutorial
{
class CreateDirectory
{
static void Main(string[] args)
{
//set a working directory
string WorkingDirectory = @”C:\Users\abhinsv\Desktop\Imageresize_src”;
System.IO.Directory.CreateDirectory(WorkingDirectory + @”\images”);
}
}
}
If you are uninitiated in C Sharp, you may like to check CSharp Tutorial for beginners.
Here is the complete code to do this.
Related posts: