title: FTP file download using Delphi IdFTP
body: <p>I am new to delphi, I need to write an ftp client program that will go through a text file with list of ftp addresses, and download the subfolders from an ftp site .
  I have successfully hooked to the server but got stuck on the download part. can someone please help me with the codes to insert in the download procedure</p>
  
  <pre><code> procedure TCleint.btnConnectClick(Sender: TObject);
  begin
      try
         if not IdFTP.Connected then
         begin
             IdFTP.Host := 'ftp server';
             IdFTP.Username := 'anonymous';
             IdFTP.Password := 'emailaddress';
             IdFTP.Port := 21;
             IdFTP.Connect;
  
             IdFTP.List(listaDirectory.Items, '', false);
  
             btnConnect.Enabled := False;
             btnDisconnect.Enabled := True;
             btnDownload.Enabled := True;
  
         end;
      except
           on E:Exception do
           begin
               MessageDlg('connection error!', mtError, [mbOK], 0);
               btnConnect.Enabled := true;
               btnDisconnect.Enabled := false;
               btnDownload.Enabled := false;
           end;
      end;
  end;
  
  procedure TCleint.btnDisconnectClick(Sender: TObject);
  begin
      try
         if IdFTP.Connected then
         begin
             IdFTP.Disconnect;
  
             listaDirectory.Clear;
             btnConnect.Enabled := True;
             btnDisconnect.Enabled := False;
             btnDownload.Enabled := False;
         end;
      except
          on E:Exception do
          begin
            MessageDlg('connection error!', mtError, [mbOK], 0);
            btnConnect.Enabled := false;
            btnDisconnect.Enabled := true;
            btnDownload.Enabled := true;
          end;
      end;
  end;
  
  procedure TCleint.btnDownloadClick(Sender: TObject);
  begin
  
  end;
  
  end.
  </code></pre>