Hi,
I don't know if you know something about TALWinInteFTPClient, but maybe it doesn't depend on it. I am using this class to access to the ftp server. I connect, then I check the connection and everything is good.

So I need to get the tree of files and directories on the ftp server. To do this, I use this function:

procedure TForm2.FileTransfer(const PathName, FileName, RemotePath : string; const InDir : boolean);
var Rec  : TALFtpclientSearchRec;
    Path : string;
begin
Path := PathName;
if ALWinInetFTPClient11.FindFirst(Path + FileName, faAnyFile, Rec) = 0 then
 try
   repeat
     if (Rec.Attr = faDirectory) AND (InDir) AND (Rec.Name <> '.') AND (Rec.Name <> '..') then
       FileTransfer(Path + Rec.Name + '/',FileName,RemotePath,InDir)
     else
       if (Rec.Name <> '.') AND (Rec.Name <> '..') then
         Memo1.Lines.Add(Path + Rec.Name);
   until ALWinInetFTPClient11.FindNext(rec) <> 0;
 finally
   ALWinInetFTPClient11.FindClose(rec);
 end;
end;

for example, let's have this directory on ftp, "data". In the "data", there is directory named "web" which contains one file. And in the "data", there's another file too. After I run this procedure with first parameter set to "data/", the Memo1 shows this "data/file.php". But the next directory "data/web/" is just opened. There's a file but this procedure at FindFirst will stop and return. So in the Memo1 is just one line, "data/file.php".
+data
+web
-img.jpg
-file.php
I don't know, why the "FindFirst" stop when it goes into another directory.
Please, could you help me? :icon_rolleyes:

Thew, try to add faDirectory to file attribute search param:
if ALWinInetFTPClient11.FindFirst(Path + FileName, faDirectory or faAnyFile, Rec) = 0 then

Bye

I've already tried to fix this problem and now I know what was wrong. FindFirst and FindNext are allowed in AlWinInetFTPClient, but you cannot use this to explore subdirectories, because you can have just one instance opened. And another problem could be, if you have your own ftp server, and you're experiencing problems with connecting to this server with AlWinInetFTPClient, try to setup option wFtpIo_Passive to true. This help you can find on MSDN i think.

This article has been dead for over six months. Start a new discussion instead.