Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

RmDir Function

Removes an existing directory or folder.

Public Sub RmDir(ByVal Path As String)

Parameter

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

Exceptions/Errors

Exception type Error number Condition
ArgumentException 52 Path is not specified or is empty.
IOException 75 Target directory contains files.
FileNotFoundException 76 Directory does not exist.

Remarks

An error occurs if you try to use RmDir on a directory or folder containing files. Use the Kill function to delete all files before attempting to remove a directory or folder.

Example

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

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

Smart Device Developer Notes

This function is not supported.

Requirements

Namespace: Microsoft.VisualBasic

Module: FileSystem

Assembly: Microsoft Visual Basic .NET Runtime (in MicrosoftVisualBasic.dll)

See Also

ChDir Function | CurDir Function | Kill Function | MkDir Function | ArgumentException Class | IOException Class | FileNotFoundException Class

Show:
© 2015 Microsoft