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;