SystemRmDir (Object Pascal)

From Appmethod Code Examples
Jump to: navigation, search

Description

This example requires a text edit and a button. Enter the folder to remove the text edit and click the button. The path is relative to the project folder.

Code

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;

Uses