FileSystem.RmDir Method

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.

Namespace:  Microsoft.VisualBasic
Assembly:  Microsoft.VisualBasic (in Microsoft.VisualBasic.dll)

public static void RmDir(
	string Path
)

Parameters

Path
Type: System.String

Required. 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.

ExceptionCondition
ArgumentException

Path is not specified or is empty.

IOException

Target directory contains files.

FileNotFoundException

Directory does not exist.

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.

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

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft