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;
function DirectoryExists(Name: string): Boolean; - 指定文件夹是否存在
例:
procedure TForm1.Button1Click(Sender: TObject);
begin
if DirectoryExists('c:/d') then
showmessage('yes')
else
showmessage('no');
end;