RMDIR function

Purpose:

RMDIR removes a directory.

Syntax:

RetVal = RMDIR(DirectoryName AS STRING)

Return Value:

  • Data type: INTEGER
    RetVal 0 if the removal of the directory is successful, -1 if not successful.

Parameters:

  • Data type: STRING
    DirectoryName Name of the directory to be removed.

Remarks:

👉 RMDIR can remove only one directory each time it is invoked. In the following example, only the directory "BCX" can be removed. Also, the directory must be empty of files for RMDIR to remove the directory.

Example:

DIM DirectoryName$
DIM RetVal%

DirectoryName$ = "C:\Temp\BCX"

RetVal% = RMDIR(DirectoryName$)
IF RetVal% = 0 THEN
  PRINT "RMDIR removed the directory " & DirectoryName$
ELSEIF RetVal% = -1 THEN
  PRINT "RMDIR could not remove the directory."
END IF

Result:

RMDIR removed the directory C:\Temp\BCX