您的位置: 网站首页 > 编程乐园 > 阅读文章

Delphi学习笔记 – 创建和删除文件夹

Delphi学习笔记

forcedirectories函数用于创建一个DIR参数指定的但系统中不存在的文件夹;
rmidir函数用于删除一个参数指定的子目录。

Delphi创建和删除文件夹源代码:

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if(directoryexists(edit1.text))then
showmessage('文件夹已经存在!')
else
begin
if application.MessageBox(pchar('是否创建文件夹'+edit1.text),'操作提示',mb_yesno)=mryes then
begin
forcedirectories(edit1.text);
end;
end;
end;

  procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
if (directoryexists(edit1.text)) then
  begin
  if application.MessageBox(pchar('是否删除文件夹'+edit1.text),'操作提示',mb_yesno)=mryes then
    begin
    rmdir (edit1.text);
    edit1.clear;
    end;
  end;
  • 属于分类: 编程乐园
  • 本文标签:
  • 人气指数: 2,871
  • 文章作者: 野球小子
  • 生产日期: 2007年11月04日 - 15时50分53秒
看看还有没有您感兴趣的:

  • 您的大名(必填)
  • E-Mail (必填)
  • 您的网站(有的话就写一下吧~)
  • 评论内容:(必填)