<<Use FtpTst sample program to better understand what the commands are
doing. 
You get edit boxes to enter data and a button for most of the commands.>>

Thanks, but what I still don't see is how I can direct the ftp'd files to be
placed on my local machine. IOW, I know can direct the listing via the
List() method to be written to the value I assign to the LocalFileName
property, but when I loop through the file names listed in that file, how do
I direct the Get() function to place them in a certain location?

IOW, say I end up with a file named "NailFiles.txt" in C:\Misc, which
contains the following lines/file names:

arg.DAT
bat.DAT
cat.DAT
dog.DAT
eat.DAT
fat.DAT
goo.DAT
hat.DAT
...etc.

and that I want to Get() all the files that match the mask "*at.dat"

How can I direct that the files I choose to ftp get sent to "C:\AtDatFiles\"
when I call the Get() method?

The code I have so far is below:

procedure TfKDQServer.GetFTPFiles;
var
  sFileName: String;
  sl: TStringList;
  i: Integer;
  ICSFTP: TFTPClient;
begin
  ICSFTP := TFTPClient.Create(nil);
  try
    ICSFTP.UserName := 'nbc';
    ICSFTP.Password := 'howardCosell'; 
    ICSFTP.Binary   := TRUE;  //is this correct/needed?
    ICSFTP.Passive  := TRUE;  //needed?
    ICSFTP.LocalAddr := 'localhost';
    ICSFTP.Port := 'ftp';
    ICSFTP.SocksPort := '21'; //'ftp';
    ICSFTP.SocksUserCode := 'nbc';  //needed?
    ICSFTP.SocksPassword := 'howardCosell'; //needed?
    ICSFTP.HostDirName := '/FootballSongs/DandyDan/TurnOutTheLights';
    ICSFTP.HostFileName := '*.DAT';
    ICSFTP.HostName := '20.96.195.28';
    ICSFTP.LocalFileName := 'C:\Misc\FilesInHostDir.txt';
    if not ICSFTP.Connect then
      Exit; 
    ICSFTP.Cwd;
    ICSFTP.List; 
    try
      sl := TStringList.Create;
      sl.LoadFromFile(ICSFTP.LocalFileName);
      for i := 0 to Pred(sl.Count) do
        if IsAWantedFile(sl[i]) then begin
          ICSFTP.HostFileName := sl[i];
          ICSFTP.Get;
        end;
    finally
      sl.Free;
    end;
  finally
    ICSFTP.Quit; //needed?
    ICSFTP.Free;
  end;
end;



The information transmitted is intended only for the person or entity to
which it is addressed and may contain confidential and/or privileged
material.  If the reader of this message is not the intended recipient,
you are hereby notified that your access is unauthorized, and any review,
dissemination, distribution or copying of this message including any
attachments is strictly prohibited.   If you are not the intended
recipient, please contact the sender and delete the material from any
computer.
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://www.elists.org/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to