[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] | Reference for unit 'System' (#rtl)

# RmDir

Remove directory when empty.

## Declaration

Source position: systemh.inc line 1362

`procedure RmDir(`
`const s: shortstring`
`); overload; procedure RmDir(`
`const s: RawByteString`
`); overload; procedure RmDir(`
`const s: unicodestring`
`); overload;`

## Description

Rmdir removes the directory S.

## Errors

Depending on the state of the {$I} switch, a runtime error can be generated if there is an error. In the {$I-} state, use IOResult to check for errors.

## See also

Chdir |  | Change current working directory.
Mkdir |  | Create a new directory.

## Example

    Program Example53;

    { Program to demonstrate the MkDir and RmDir functions. }

    Const D : String[8] = 'TEST.DIR';

    Var S : String;

    begin
      Writeln ('Making directory ',D);
      Mkdir (D);
      Writeln ('Changing directory to ',D);
      ChDir (D);
      GetDir (0,S);
      Writeln ('Current Directory is : ',S);
      WRiteln ('Going back');
      ChDir ('..');
      Writeln ('Removing directory ',D);
      RmDir (D);
    end.