| ForceDirectories creates all the directories along a directory path |
Product: Delphi all versions | Category: System | Skill Level:
 | Scoring:  | Last Update: 01/01/2000 |
Search Keys: delphi delphi3000 article borland vcl code-snippet ForceDirectories | Times Scored: 11 | Visits: 2758 |
Uploader: Bernhard Angerer Company: bluestep.com IT Consulting | Reference: Borland Delphi Help |
| |
Question/Problem/Abstract:
|
Answer:
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:
uses
FileCtrl;
...
procedure TForm1.Button1Click(Sender: TObject);
var
Dir: string;
begin
Dir := 'C:\APPS\SALES\LOCAL';
ForceDirectories(Dir);
if DirectoryExists(Dir) then
Label1.Caption := Dir + ' was created'
end;
|