RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
System.RmDir Function

Deletes an empty subdirectory.

Pascal
procedure RmDir(const S: string); overload;
procedure RmDir(P: PChar); overload;
C++
RmDir(const AnsiString S);
RmDir(const char * P);

System

RmDir removes the subdirectory with the path specified by S or P. If the path does not exist, is non-empty, or is the currently logged directory, an I/O error occurs.

Note: In Delphi, {$I+} handles runtime errors using exceptions. When using {$I-}, use IOResult to check for I/O errors.
 

Delphi Examples: 

 

{
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;

 

ChDir 

GetDir 

MkDir 

RemoveDir

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!