谢谢!

解决方案 »

  1.   

    CreateDir(dirname)若成功創立為true.
      

  2.   

    if CreateDir('e:\test') then
      ShowMessage('创建成功!');
      

  3.   

    function DirExists(Name: string): Boolean;
    {$IFDEF WIN32}
    var
      Code: Integer;
    begin
      Code := GetFileAttributes(PChar(Name));
      Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
    end;
    {$ELSE}
    var
      SR: TSearchRec;
    begin
      if Name[Length(Name)] = '\' then Dec(Name[0]);
      if (Length(Name) = 2) and (Name[2] = ':') then
        Name := Name + '\*.*';
      Result := FindFirst(Name, faDirectory, SR) = 0;
      Result := Result and (SR.Attr and faDirectory <> 0);
    end;
    {$ENDIF}