FileSystem.RmDir(String) Method

Definition

Removes an existing directory. The My feature gives you better productivity and performance in file I/O operations than RmDir. For more information, see DeleteDirectory.

public:
 static void RmDir(System::String ^ Path);
public static void RmDir (string Path);
static member RmDir : string -> unit
Public Sub RmDir (Path As String)

Parameters

Path
String

Required. A string expression that identifies the directory or folder to be removed. Path can include the drive. If no drive is specified, RmDir removes the directory on the current drive.

Exceptions

Path is not specified or is empty.

Target directory contains files.

Directory does not exist.

Examples

This example uses the RmDir function to remove an existing directory.

' Assume that MYDIR is an empty directory.
' Remove MYDIR.
RmDir("MYDIR")

Remarks

An error occurs if you try to use RmDir on a directory that contains files. Use the Kill function to delete all files before you try to remove a directory.

Applies to

See also