NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Directory.CreateDirectories

Creates all directories specified by path.

[Visual Basic]
Public Shared Function CreateDirectories( _
   ByVal path As String _
) As Directory
[C#]
public static Directory CreateDirectories(
   string path
);
[C++]
public: static Directory* CreateDirectories(
   String* path
);
[JScript]
public static function CreateDirectories(
   path : String
) : Directory;

Parameters

path
The path of directories to create.

Return Value

All directories specified by path.

Exceptions

Exception Type Condition
ArgumentException path is an empty string ("") or contains only whitespaces.
ArgumentNullException path is null.
DirectoryNotFoundException Part of the directory is not found.
IOException A file or directory already has the name specified by path.
PathTooLongException The specified path is too long.
SecurityException The caller does not have the required permission.

Remarks

The path parameter specifies a directory path, not a file path.

Unlike the CreateDirectory method, CreateDirectories will create as many directories as are required to guarantee that the specified path is valid. It is not an error if some or all of the specified directories exist.

Note   Path names are limited to 248 characters.

Requirements

NGWS Runtime Security:

FileIOPermissionAccess Write flag required for write permission to the path.

Example

To create the directory "C:\Users\User1\Public\Html" when the current directory is "C:\Users\User1", use any of the following calls:

CreateDirectories("Public\\Html")

CreateDirectories("\\Users\\User1\\Public\\Html")

CreateDirectories("c:\\Users\\User1\\Public\\Html")

Note that an escape character is required by many languages toensure that the backslash is interpreted properly.

See Also

Directory Class | Directory Members | System.IO Namespace | CreateDirectory | CreateSubdirectories