创建可用:ForceDirectories
检查可用:DirectoryExists

解决方案 »

  1.   

    if not DirectoryExists('c:\temp') then
        if not CreateDir('C:\temp') then
        raise Exception.Create('Cannot create c:\temp');
      

  2.   

    SetCurrentDir函数是不能创建不存在的文件夹
      

  3.   

    procedure TForm1.Button1Click(Sender: TObject);var
      Dir: string;
    begin  Dir := 'C:\APPS\SALES\LOCAL';//这个目录可以自己定义  if DirectoryExists(Dir) then
        Label1.Caption := Dir + ' was created'end;
      

  4.   

    关于创建的用法
    unit Unit1;interfaceuses
      Windows, Messages, filectrl ,SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        procedure Button1Click(Sender: TObject);
      private
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}
    procedure TForm1.Button1Click(Sender: TObject);
    var
      dest:string;
    begin
      dest:='f:/dd';
      ForceDirectories(dest);end;end.