procedure TForm1.Button1Click(Sender: TObject); var Pach:string; begin Pach:='E:\123\223'; //定义目录地址 if not DirectoryExists(pach) then //查找文件夹是否存在 begin //建立文件夹(ForceDirectories可建立多级目录,创建单级目录用:CreateDirectory) ForceDirectories(Pach); end else begin showmessage('目录已经存在'); end; end;