Home > Uncategorized > Create a new directory - Csharp Tutorial

Create a new directory - Csharp Tutorial

February 17th, 2012

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.


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.


  1. No comments yet.
  1. No trackbacks yet.