The RmDir statement deletes the directory specified in the Path parameter.
The required parameter Path must be a string or expression that can represent a valid DOS file structure path value, must contain a directory name, may contain a relative path structure, and may contain a drive letter. The Path parameter must be limited to less than 128 characters.
The RmDir statement is relative to the current directory. If no path structure is provided, the directory is expected to be a subdirectory of the current directory. If no drive is specified, the RmDir statement deletes the directory on the current drive.
The current directory cannot be deleted. To change the current directory to another directory, use the ChDir statement. The directory to be deleted must be empty and contain no files or sub-directories. To delete files in a directory, use the Kill statement.
Note: The file system keeps track of the current drive, and the current directory of every drive. Use the CurDir statement to determine the current directory. The current drive letter can be extracted from the Left character returned in the CurDir statement.
A string or expression that can represent a valid DOS file structure path value. This includes a directory name, and may include a relative or static directory or folder structure and drive letter, in the order:
[<driveletter>:][\<rootdirectoryname>][\<subdirectory> ... \<subdirectory>\] directoryname
Note: The path can be relative to the current directory. A single period represents the current directory (.). Two periods represent the parent directory of the current directory (..). For example, chdir .. changes to the parent directory of the current directory. chdir ..\test changes to the test subdirectory of the parent directory
ChDir | ChDrive | CurDir, CurDir$ | Dir | MkDir
Dim strDir As String
strDir = CurDir ' retrieve current directory name
Kill "*.*" ' delete all files from current directory
ChDir "\" ' change to root dir on current drive
RmDir strDir ' delete directory