Share via


RD | RMDIR Command

Removes a directory or folder from disk.

RD cPath | RMDIR cPath

Parameters

  • cPath
    Specifies the name and location of the directory or folder to remove from disk.

Remarks

Visual FoxPro generates an error message if you attempt to remove a directory or folder that is not empty.

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 | GETDIR( ) | HOME( ) | MD | MKDIR | SET DEFAULT | SET PATH | SYS(5) – Default Drive | SYS(2003) – Current directory | SYS(2004) – Visual FoxPro Start Directory