Help Center
Help CenterFreeBASIC

RmDirfunction

Removes a folder/directory from the file system

Operating System Functionsfunctiondocumented

Syntax

Declare Function RmDir ( ByRef folder As Const String ) As Long

Parameters

NameDescription
folderThe folder/directory to be removed.

Return value


Returns zero (0) on success, and negative one (-1) on failure.

Description


Removes a folder from the file system. The function will fail if the folder is not empty.

Remarks

Usage


result = RmDir( folder )

Platform Differences


  • Linux requires the folder case matches the real name of the file. Windows and DOS are case insensitive.
  • Path separators in Linux are forward slashes / . Windows uses backward slashes \ but it allows for forward slashes . DOS uses backward \ slashes.

Differences from QB


  • None

See also


Example


Dim pathname As String = "foo\bar\baz"

Dim result As Integer = RmDir( pathname )



If 0 <> result Then Print "error: unable to remove folder " & pathname & " in the current path."


Reference

  • Documented in KeyPgRmdir.html