Create Directory - CSharp System.IO

CSharp examples for System.IO:DirectoryInfo

Description

Create Directory

Demo Code


using System.Diagnostics;
using System.Xml;
using System.IO.Compression;
using System.IO;//from   w w  w  . jav  a 2s. c  om
using System.Web;
using System.Text;
using System.Collections.Generic;
using System.Configuration;
using System;

public class Main{
        public static void CreateDirectory(string parentDir, string subDirName)
        {
            CreateDirectory(parentDir + PATH_SPLIT_CHAR + subDirName);
        }
        public static void CreateDirectory(string targetDir)
        {
            DirectoryInfo dir = new DirectoryInfo(targetDir);
            if (!dir.Exists)
                dir.Create();
        }
}

Related Tutorials