复制文件夹

                            uses ShellApi;

function CopyDir(SouDir, DesDir: string): Boolean;
var
  fo: TSHFILEOPSTRUCT;
begin
  Result := False;
  if not DirectoryExists(SouDir) then Exit;
  FillChar(fo, SizeOf(fo), 0);
  with fo do
  begin
    Wnd := 0;
    wFunc := FO_MOVE;
    pFrom := PChar(SouDir + #0);
    pTo := PChar(DesDir + #0);
    fFlags := FOF_NOCONFIRMATION or FOF_NOCONFIRMMKDIR or FOF_SILENT;
  end;
  if SHFileOperation(fo) = 0 then
    Result := True;
end;  

                                

查看回复