Create Directories - CSharp File IO

CSharp examples for File IO:Directory

Description

Create Directories

Demo Code


using System.Threading.Tasks;
using System.Text;
using System.Linq;
using System.IO;// w w  w  .  j a v a2 s  .c  om
using System.Collections.Generic;
using System;

public class Main{
        public static void CreateDirectories(params string[] paths)
        {
            if (paths != null && paths.Length > 0)
            {
                foreach (var path in paths)
                {
                    DirectoryInfo d = new DirectoryInfo(path);
                    if (!d.Exists)
                    {
                        d.Create();
                    }
                }
            }
        }
}

Related Tutorials