判断文件夹是否存在的函数是什么??比方说我想判断当前目录下的 s 文件夹是否存在。。
函数是什么??

解决方案 »

  1.   

    Determines whether a specified directory exists.UnitFileCtrlCategoryfile management routinesfunction DirectoryExists(Name: string): Boolean;DescriptionCall DirectoryExists to determine whether the directory specified by the Name parameter exists. If the directory exists, the function returns True. If the directory does not exist, the function returns False.If a full path name is entered, DirectoryExists searches for the directory along the designated path. Otherwise, the Name parameter is interpreted as a relative path name from the current directory.
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      if not DirectoryExists('c:\temp') then
        if not CreateDir('C:\temp') then
        raise Exception.Create('Cannot create c:\temp');
    end;