RMDIR()

From Liberty BASIC Family
Jump to navigation Jump to search
Supported in Just BASIC Supported in Liberty BASIC Not supported in Liberty BASIC 5 Supported in Run BASIC

Description

This function attempts to remove the empty directory specified in dirName. If successful, the function returns 0; otherwise, a system error code is returned.
See MSDN for a list of System Error Codes (0-499)
See also MKDIR() to make a directory.

Syntax

  1. retValue = rmdir("dirName")

Hints

To confirm that the directory was successfully removed, use this test to check the value returned by the function:
    result =  rmdir("dirName")
    if result <> 0 then notice "Directory not removed."
    end

Example

' To remove a folder named "temp" in the current directory
' and confirm the removal:

    result = rmdir("temp")
    ' Check if folder is existing
    if result = 2 then print "Folder does not exist."

    ' Test if successful
    if result <> 0 then
        print "Folder was not removed."
    else
        print "Folder has been removed from ";DefaultDir$
    end if

    end

Useful Procedures

' Place a useful function or sub using this keyword here