怎样遍历一目录树并将其子目录及文件拷贝到另一地方

wytwhm 2003-07-31 09:31:34
如题,如有代码请贴出来或发我E-mail:wrt657@21cn.com,万分感激……………………………………………………………………………………
...全文
66 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
Drate 2003-08-28
  • 打赏
  • 举报
回复
//复制目录树
procedure copydirectorytree(ahandle:THandle;const aFromDirectory,aToDirectory:string);
var shfileopstruct:TSHFileOpStruct;
fromdir:pchar;
todir:pchar;
begin
getmem(fromdir,length(afromdirectory)+2);
try
getmem(todir,length(atodirectory)+2);
try

fillchar(fromdir^,length(afromdirectory)+2,0);
fillchar(todir^,length(atodirectory)+2,0);

strcopy(fromdir,pchar(afromdirectory));
strcopy(todir,pchar(atodirectory));

with shfileopstruct do
begin
wnd:=ahandle;
wfunc:=fo_copy;
pfrom:=fromdir;
pto:=todir;
fflags:=fof_noconfirmation;// or fof_renameoncollision;
fanyoperationsaborted:=false;
hnamemappings:=nil;
if shfileoperation(shfileopstruct)<>0 then raiselastwin32error;
end;
finally
freemem(todir,length(atodirectory)+2);
end;
finally
freemem(fromdir,length(afromdirectory)+2);
end;
end;
happyliy 2003-08-28
  • 打赏
  • 举报
回复
只知道单文件拷贝,如果有多遍历一目录树并将其子目录及文件拷贝到另一地方的程序,给我也发一份,My_email : happyliy@163.com,感谢!
Eastunfail 2003-07-31
  • 打赏
  • 举报
回复
http://expert.csdn.net/Expert/topic/2095/2095217.xml?temp=.6852533

1,184

社区成员

发帖
与我相关
我的任务
社区描述
Delphi Windows SDK/API
社区管理员
  • Windows SDK/API社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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