RmDir


Function RmDir( path )


Returns 1 on success, 0 on failure to remove directory named by path.


Syntax IF RmDir( "C:\Program Files\MyWorkDir") THEN PRINT "It is done."


Remarks

Rmdir will remove the directory named in path with the following restrictions:

The directory must be empty of all files, including hidden and system files.

The directory must exist.


See Also:

ChDir Cwd MkDir Kill File and Directory functions


Example Script


STRING a

STRING sDir = "C:\Temp\WorkDir"

NUMBER Tries = 0


: start

Tries ++


IF NOT RMDIR(sDir) THEN

IF(CHDIR(sDir)) THEN

a = FINDFIRST("*.*")

WHILE LEN(a)

IF NOT KILL(a) THEN

PRINT "Could not get rid of " + sdir + "\" a

ELSE

PRINT "Removed " + sdir + "\" a

ENDIF

a = FINDNEXT()

WEND

ENDIF

IF Tries == 1 THEN GOTO start ENDIF ' We'll try twice to get rid of it.

ELSE

PRINT "C:\Temp\WorkDir has been removed."

ENDIF