DelphiBasics
CreateDir
Function
Create a directory SysUtils unit
 function CreateDir(const Dir string):Boolean;
Description
The CreateDir function creates a new directory Dir in the current directory.
 
If the create succeeded, the True is returned, otherwise the error can be obtained using GetLastError.
Related commands
ChDirChange the working drive plus path for a specified drive
GetCurrentDirGet the current directory (drive plus directory)
GetDirGet the default directory (drive plus path) for a specified drive
MkDirMake a directory
RemoveDirRemove a directory
RmDirRemove a directory
SelectDirectoryDisplay a dialog to allow user selection of a directory
SetCurrentDirChange the current directory
ForceDirectoriesCreate a new path of directories
 Download this web site as a Windows program.




 
Example code : Create a new directory
begin
  // Create a new directory in the current directory
  if CreateDir('TestDir')
  then ShowMessage('New directory added OK')
  else ShowMessage('New directory add failed with error : '+
                   IntToStr(GetLastError));
end;
Show full unit code
  New directory added OK
 
Delphi Programming © Neil Moffatt . All rights reserved.  |  Home Page