高分问一下 delphi如何新建、复制或者文件夹?

pgz_007 2008-09-01 05:15:46
1、如何判断目标文件夹里面是否有某名字(比如新建文件夹1)的文件夹?
if 有此文件夹(新建文件夹1) then exit
else 没有 then 新建此名字的文件夹

2、我用函数WinExec('xcopy c:\test\*.txt d:\temp\', SW_HIDE)批量复制文件的时候,如何判断目标文件夹里是否有同名字的文件?我希望有的话就替换。
...全文
120 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
手指风 2008-09-02
  • 打赏
  • 举报
回复
多找找帮助,帮助上都有这些函数的。
gyk120 2008-09-02
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 SmallHand 的回复:]
1.

Delphi(Pascal) codeuses FileCtrl;

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;



2.WinExec('xcopy c:\test\*.txt d:\temp\ -y', SW_HIDE)
[/Quote]
火龙岛主 2008-09-01
  • 打赏
  • 举报
回复
1.
uses FileCtrl;

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;


2.WinExec('xcopy c:\test\*.txt d:\temp\ -y', SW_HIDE)

16,748

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 语言基础/算法/系统设计
社区管理员
  • 语言基础/算法/系统设计社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧