Problem with List Command in TIdFTP

Giganews Newsgroups
Subject: Problem with List Command in TIdFTP
Posted by:  Mikael Lenfors (mika…@lenfors.se)
Date: Thu, 6 Mar 2008

Hello!

I have a FTP unit used in several projects. Among others it uses the LIST
function.It usually works without any problems but now when connectiong to a
new FTP server i get an exception.

The error I get is:
'Failed reading directory (550)'
'Error: *: No such file or directory.'#$D#$A

If I debug and check the FSystemDesc property it says 'UNIX Type: L8'.

If I do exactly the same FTP commands from a DOS FTP it works and I get the
following result;

C:\>ftp <ftpserver>
Connected to <ftpserver>
220 <ftpserver> FTP server ready.
User <ftpserver>: <ftpuser>
331 Password required for <ftpuser>.
Password:
230 User <ftpuser> logged in.  Access restrictions apply.
ftp> cd /pub/outbound
250 CWD command successful.
ftp> dir
200 PORT command successful.
150 Opening ASCII mode data connection for /bin/ls.
total 0
226 Transfer complete.
ftp: 9 bytes received in 0,00Seconds 9000,00Kbytes/sec.
ftp>

If I instead of calling  IndyFTP.List(Files, '', False); only call
IndyFTP.List; then I don't get an exception!

Any ideas?

Regards, Mikael

Code in FTP my FTP unit ---------------------

      With IndyFTP Do
      Begin
        Try
            Connect; // Connect and login
            Try
              If FTPPath <> '' Then
                  ChangeDir(FTPPath);
              Try
                  Files.Clear;
                  IndyFTP.List(Files, '', False);
              Except
                  On E: Exception Do
                  Begin
                    Logg(2, 'Failed reading directory (' +
IntToStr(IndyFTP.LastCmdresult.NumericCode) + ')', 0);
                    Logg(2, 'Error: ' + E.Message, 0);
                  End;
              End;
            Except
              On E: Exception Do
              Begin
                  Logg(2, 'Failed changing directory', 0);
                  Logg(2, 'Error: ' + E.Message, 0);
              End;
            End;
            IndyFTP.Disconnect;
        Except
            On E: Exception Do
            Begin
              Logg(2, 'Failed connecting to FTP server', 0);
              Logg(2, 'Error: ' + E.Message, 0);
            End;
        End;

Replies