Wikia

Delphi Programming

CreateDir Routine

2,918pages on
this wiki
Talk0
This page is intended as a supplement to the official documentation on Delphi programming. CodeGear is in the process of putting the Delphi documentation on the Web. Once they have done so, this page will link to the relevant page in the official documentation.
Stub
This article is a stub.
Please help enhance the Delphi Programming Wiki by expanding it.
Info
see the VCL Documentation Guidelines for an overview on doc pages

UnitEdit

DescriptionEdit

Definition (Delphi 6, 2007, 2010):

function CreateDir(const Dir: string): Boolean;

Creates a directory in the current directory when using a relative path otherwise the directory is made at the absolute path given. True will be returned if the directory creation was successful and false when an error occurred. When false you can use GetLastError to retrieve the value of it's failure.

CreateDir is a wrapper function for the CreateDirectoryA (Delphi 6), CreateDirectoryW (Delphi 2010) API which is the ansi version of CreateDirectory.

Technical CommentsEdit

(Known issues / Documentation clarifications / Things to be aware of)

ExamplesEdit

procedure TForm1.btnCreateDirectoriesClick(Sender: TObject);
begin
  CreateDir('C:\test');
  SetCurrentDir('C:\test');    //set the new current directory to C:\test
  CreateDir('InsideTestDir');  //creates directory C:\test\InsideTestDir
  CreateDir('..\InRootDir');   //creates C:\InRootDir
end;

Using the following form:

object Form1: TForm1
  Left = 571
  Top = 138
  Width = 169
  Height = 96
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object btnCreateDirectories: TButton
    Left = 32
    Top = 16
    Width = 97
    Height = 25
    Caption = 'Create Directories'
    TabOrder = 0
    OnClick = btnCreateDirectoriesClick
  end
end

See AlsoEdit

(Please provide links to items specifically related to this item.)

User Comments/TipsEdit

(Please leave your name with your comment.)

Around Wikia's network

Random Wiki