Frequently Asked Component Specific Questions

Options

Display all FAQ items

Search FAQ items:


Displaying items 1 to 1 of 1, page 1 of 1

<< previous next >>

TWebCopy
Retrieving list of files on the FTP server

To retrieve a list of files on the FTP server, following code can be used:
var
 i: integer;
begin
  webcopy.Items.Clear;
  with webcopy.Items.Add do
  begin
    FTPHost := 'ftp.server.com';
    FTPUserID := 'user';
    FTPPassword := 'pasword';
    Protocol := wpFtpList;
    TargetDir := 'c:\temp';
    URL := 'ftpdirectory\*.txt';
  end;
  webcopy.Execute;
  for i := 0 to webcopy.Items[0].FileDetails.Count - 1 do
  begin
    listbox.Items.Add(webcopy.Items[0].FileDetails[i].FileName);
  end;
end;