Creates all the directories in the specified path, applying the specified Windows security. - CSharp Operating System

CSharp examples for Operating System:Windows

Description

Creates all the directories in the specified path, applying the specified Windows security.

Demo Code

//      Permission is hereby granted, free of charge, to any person obtaining a copy
using global::System.Environment;
using global::System.Security.AccessControl;
using global::System.Collections.Generic;
using global::System.Linq;
using global::System.IO;
using global::System;

public class Main{
        /// <summary>
        /// Creates all the directories in the specified path, applying the specified Windows security.
        /// </summary>
        /// <param name="path">The directory to create.</param>
        /// <param name="directorySecurity">The access control to apply to the directory.</param>
        public static void CreateDirectory(string path, DirectorySecurity directorySecurity)
        {/*from  w  w w .ja v a2s . c o m*/
            Directory.CreateDirectory(GetFullPath(path), directorySecurity);
            Logger.Log("Directory {0} has been created", path);
        }
        #region Directory Members

        /// <summary>
        /// Creates all directories and subdirectories as specified by path.
        /// </summary>
        /// <param name="path">The directory to create.</param>
        public static void CreateDirectory(string path)
        {
            Directory.CreateDirectory(GetFullPath(path));
            Logger.Log("Directory {0} has been created", path);
        }
}

Related Tutorials