Copiar arquivo em rede
como copiar um arquivo em rede atraves do delphi??? :lol:
Jabanildo
Curtidas 0
Respostas
Anonymous
15/02/2003
procedure TForm1.Button2Click(Sender: TObject);
var
SR: TSearchRec;
I: integer;
Origem, Destino: string;
begin
I := FindFirst(´c:\Origem\*.*´, faAnyFile, SR);
while I = 0 do begin
if (SR.Attr and faDirectory) <> faDirectory then begin
Origem := ´c:\Origem\´ + SR.Name;
Destino := ´c:\Destino\´ + SR.Name;
if not CopyFile(PChar(Origem), PChar(Destino), true) then
ShowMessage(´Erro ao copiar ´ + Origem + ´ para ´ + Destino);
end;
I := FindNext(SR);
end;
end;
Para copiar na rede, substitua o ´c:\Destino\ por \\nomeservidor\destino\
espero ter ajudado
var
SR: TSearchRec;
I: integer;
Origem, Destino: string;
begin
I := FindFirst(´c:\Origem\*.*´, faAnyFile, SR);
while I = 0 do begin
if (SR.Attr and faDirectory) <> faDirectory then begin
Origem := ´c:\Origem\´ + SR.Name;
Destino := ´c:\Destino\´ + SR.Name;
if not CopyFile(PChar(Origem), PChar(Destino), true) then
ShowMessage(´Erro ao copiar ´ + Origem + ´ para ´ + Destino);
end;
I := FindNext(SR);
end;
end;
Para copiar na rede, substitua o ´c:\Destino\ por \\nomeservidor\destino\
espero ter ajudado
GOSTEI 0