procedure TForm1.btn1Click(Sender: TObject); var path:string; begin path := edt1.Text; if path <> '' then begin path := StringReplace(path, '/', '\', [rfReplaceAll]); if not DirectoryExists(path) then //查找文件夹是否存在 begin //建立文件夹(ForceDirectories可建立多级目录,创建单级目录用:CreateDirectory) ForceDirectories(path); end else begin showmessage('目录已经存在'); end; end else begin ShowMessage('请填写目录'); end; end;
转载于:https://www.cnblogs.com/qqook/p/3444984.html