unit SystemRmDir;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: SystemRmDir
// Routine: System.RmDir

// BeginCode
{
This example requires a text edit and a button.  Enter the
folder to remove in the text edit and click the button.  The
path is relative to the project folder.
}
procedure TForm1.Button1Click(Sender: TObject);
begin
   {$I-}
   { Get directory name from TEdit control }
   RmDir(Edit1.Text);
   if IOResult <> 0 then
     MessageDlg('Cannot remove directory', mtWarning, [mbOk], 0, mbOk)
   else
     MessageDlg('Directory removed', mtInformation, [mbOk], 0, mbOk);
end;
// EndCode
// EndExample: SystemRmDir
end.
