Share via


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)

Syntax

'Declaration
Public Shared Function CreateDirectory ( _
    path As String _
) As DirectoryInfo
public static DirectoryInfo CreateDirectory(
    string path
)
public:
static DirectoryInfo^ CreateDirectory(
    String^ path
)
static member CreateDirectory : 
        path:string -> DirectoryInfo 
public static function CreateDirectory(
    path : String
) : DirectoryInfo

Parameters

Return Value

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

Remarks

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.

.NET Framework Security

See Also

Reference

Directory Class

System.IO Namespace