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.

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:

  1. How to find the Number of Cores and Logical Processors using C#.net
  2. Javascript Textarea Tutorial
  3. Allegro PCB Viewer
  4. PHP Tutorial – checkbox form

Uncategorized

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