FileSystem.MkDir(String) Method

Definition

Creates a new directory. The My feature gives you better productivity and performance in file I/O operations than MkDir. For more information, see CreateDirectory(String).

C#
public static void MkDir(string Path);

Parameters

Path
String

Required. A string expression that identifies the directory to be created. The Path may include the drive. If no drive is specified, MkDir creates the new directory on the current drive.

Exceptions

Path is not specified or is empty.

Permission denied.

Directory already exists.

Examples

This example uses the MkDir function to create a directory. If the drive is not specified, the new directory is created on the current drive.

VB
' Make new directory.
MkDir("C:\TESTDIR")

Remarks

This function creates a new directory.

Applies to

Product Versions
.NET Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1

See also