unit ForceDirectories;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

// BeginExample: ForceDirectories
// Routine: SysUtils.ForceDirectories

// BeginCode
{
This example uses a label and a button on a form. When the
user clicks the button, all the directories along the
specified path that don't exist are created. The results are
reported in the caption of the label:
} 
procedure TForm1.Button1Click(Sender: TObject);
var
  Dir: string;
begin
  Dir := 'C:\APPS\SALES\LOCAL';
  if SysUtils.ForceDirectories(Dir) then
    Label1.Caption := Dir + ' was created'
end;
// EndCode
// EndExample: ForceDirectories
end.
