CreateDirectory Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Creates all directories and subdirectories in the specified path.

Namespace:  System.IO
Assembly:  System.IO (in System.IO.dll)

public static DirectoryInfo CreateDirectory(
	string path


Type: System..::..String
The directory path to create.

Return Value

Type: System.IO..::..DirectoryInfo
An object that represents the directory for the specified path.

Any and all directories specified in path are created, unless they already exist or unless some part of path is invalid. 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.

Trailing spaces are removed from the end of the path parameter before creating the directory.

Creating a directory with only the colon character (:) is not supported, and will cause a NotSupportedException to be thrown.