![]() SecurityRules.AddAccessRule(new FileSystemRights.Read, AccessControlType.Allow)) using System ĭirectorySecurity securityRules = new DirectorySecurity() The following example creates a new directory with access rules for two user accounts. On Unix systems, use a forward slash (/) as path separator. UNC paths are supported for example, you can specify the following for path: \\2009\Archives\December in Visual Basic, and \\\\2009\\Archives\\December in C#.Ĭreating a directory with only the colon character (:) is not supported, and will cause a NotSupportedException to be thrown. You can create a directory on a remote computer, on a share that you have write access to. Trailing spaces are removed from the end of the path parameter before creating the directory. The path parameter specifies a directory path, not a file path. ![]() If the directory already exists, this method does not create a new directory, but it returns a DirectoryInfo object for the existing directory. To create the directory C:\Users\User1\Public\Html when the current directory is C:\Users\User1, use any of the following calls to ensure that the backslash is interpreted properly: Directory.CreateDirectory("Public\Html")ĭirectory.CreateDirectory("\Users\User1\Public\Html")ĭirectory.CreateDirectory("c:\Users\User1\Public\Html")ĭirectory.CreateDirectory("Public\\Html") ĭirectory.CreateDirectory("\\Users\\User1\\Public\\Html") ĭirectory.CreateDirectory("c:\\Users\\User1\\Public\\Html") ĭirectory::CreateDirectory("Public\\Html") ĭirectory::CreateDirectory("\\Users\\User1\\Public\\Html") ĭirectory::CreateDirectory("c:\\Users\\User1\\Public\\Html") Īny and all directories specified in path are created, unless they already exist or unless some part of path is invalid. Determine whether the directory exists.Ĭonsole::WriteLine( "That path exists already." ) ĭirectoryInfo^ di = Directory::CreateDirectory( path ) Ĭonsole::WriteLine( "The directory was created successfully at. ![]() Specify the directory you want to manipulate. The following example creates and deletes the specified directory: using namespace System Path contains a colon character (:) that is not part of a drive label ("C:\"). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |