RmDir

From Delphi Pascal wiki
Jump to navigation Jump to search

Removes an empty subdirectory.

Declaration
procedure RmDir(S: String);
Target
Windows, Real, Protected
Remarks
Removes the subdirectory with the path specified by S. If the path does not exist, is non-empty, or is the currently logged directory, an I/O error occurs.
With {$I-}, IOResult returns 0 if the operation was successful. Otherwise, it returns a nonzero error code.
See Also
ChDir
GetDir
MkDir
RemoveDir


Sample Code

{RmDir.PAS}
{Sample code for the RmDir procedure.}

{ For Windows: }
{ uses WinCrt; }

begin
  {$I-}
  { Get directory name from command line }
  RmDir(ParamStr(1));
  if IOResult <> 0 then
    Writeln('Cannot remove directory')
  else
    Writeln('directory removed');
end.