Share via


MD | MKDIR Command

Creates a new directory or subdirectory on disk.

MD cPath | MKDIR cPath

Parameters

  • cPath
    Specifies a directory or a path (with a drive designator and directories).

    If cPath is a directory without a drive designator, the directory is created as a subdirectory of the current Microsoft Visual FoxPro default directory.

Remarks

Visual FoxPro generates an error message if you attempt to create a directory that already exists.

Example

The following example uses MKDIR to create a new directory named mytstdir, then CHDIR is used to change to the new directory. GETDIR( ) is used to display the directory structure, and then RMDIR is used to remove the newly created directory. GETDIR( ) is used to display the directory structure again.

SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory
MKDIR mytstdir  && Create a new directory
CHDIR mytstdir  && Change to the new directory
= GETDIR( )  && Display the Select Directory dialog box
SET DEFAULT TO HOME( )  && Restore Visual FoxPro directory
RMDIR mytstdir  && Remove the new directory
= GETDIR( )  && Display the Select Directory dialog box

See Also

CD | CHDIR | DIRECTORY | DIRECTORY( ) | GETDIR( ) | HOME( ) | RD | RMDIR | SET DEFAULT | SET PATH | SYS(5) - Default Drive | SYS(2003) - Current Directory | SYS(2004) - Visual FoxPro Start Directory