Description |
The RemoveDir function removes a directory Dir from the current directory.
If the remove succeeded, then True is returned, otherwise the error can be obtained using GetLastError.
|
|
Related commands |
ChDir |
|
Change the working drive plus path for a specified drive |
CreateDir |
|
Create a directory |
GetCurrentDir |
|
Get the current directory (drive plus directory) |
GetDir |
|
Get the default directory (drive plus path) for a specified drive |
MkDir |
|
Make a directory |
RmDir |
|
Remove a directory |
SelectDirectory |
|
Display a dialog to allow user selection of a directory |
SetCurrentDir |
|
Change the current directory |
ForceDirectories |
|
Create a new path of directories |
|
|
|
Example code : Create a new directory and then remove it |
begin // Create a new directory in the current directory
if CreateDir('TestDir')
then WriteLn('New directory added OK')
else WriteLn('New directory add failed with error : '+
IntToStr(GetLastError));
// Remove this directory
if RemoveDir('TestDir')
then WriteLn('TestDir removed OK')
else WriteLn('TestDir remove failed with error : '+
IntToStr(GetLastError));
end;
|
Show full unit code |
TestDir added OK
TestDir removed OK
|
|