1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| if TransferringData then idFTP1.Abort;
if IdFTP1.Connected then IdFTP1.Disconnect;
try
EnableControls(false);
IdFTP1.Host := CServ;
IdFTP1.UserName := CNom;
IdFTP1.Password := CPass;
IdFTP1.Connect;
IdFTP1.Passive := True;
IdFtp1.TransferType := ftBinary;
if idFTP1.Connected then
begin
if FileExists('C:\TEMP\BaseMag.zip') then
begin
ListBox1.Clear;
if FileExists('C:\TEMP\BaseMag.zip')
then IdFTP1.List(ListBox1.Items, '*.zip', False);
if ListBox1.Count > 0 then
begin
for i := 0 to ListBox1.Count -1 do
begin
if ListBox1.Items[i]= 'BaseMag.zip' then
begin
IdFTP1.Delete('BaseMag.zip');
IdFTP1.Noop;
end;
end;
end;
FileName := 'BaseMag';
IdFTP1.Put('C:\TEMP\BaseMag.zip', 'BaseMag.zip', true);
IdFTP1.Noop;
end;
end;
finally
EnableControls(true);
end; |
Partager