tags:

views:

278

answers:

3

Hello!

I have been receiving reports from some of my users that, when using idFTP.List() from some servers (MS FTP) then the listing is received as empty (no files) when in reality there are (non-hidden) files on the current directory. May this be a case of a missing parser? The funny think, when I use the program to get the list from MY server (MSFTP on W2003) everything seems OK but on some servers I've been hitting this problem.

Using latest Indy10 on D2010. Any idea?

+2  A: 

This is usually caused by something unexpected in the directory listing which makes the list parser fail. IIS might support both NT-style and Unix-style directory listings, so make sure that you're including both listing parsers in your application and picking between them using IdFTPLaistParse.pas::CheckListing. If that doesn't help it's probably a goofy date or a something in the filename; the best way to debug it is to add code to save the raw directory listing to a file so the end user can send you a copy.

Craig Peterson
Thanks Craig. Yes, I use IdAllFTPListParsers.pas in my unit, which was working fine with those same servers before the latest I updated to Indy tiburon. The raw listing I get is03-31-10 06:55PM 1458176 SOME_FILE.mdbwhich seems to be pretty standard to me. I'll try to debug to see why no parser picks this up.
Lobuno
A: 

Are you sure you can actually establish the data connection ? The directly listing command is usually the first occasion such a listing is requested and, if you're in the wrong mode, it's usually the point where the failure occurs (i.e. the data channel connection timesout).

Stephane
Yes, I get the raw listing but it seems like none of the parsers pick it up.
Lobuno
+2  A: 

IdFTPListParseWindowsNT is broken.

The function CheckListing returns false because of a bad parsing:

if sDir = '  <DI' then begin   {do not localize}
    sDir := Copy(SData, 27, 5);
  end else begin
    sDir := Copy(SData, 26,28);  <---------------BAD PASRSING
    Result := TextStartsWith(sDir,'  <DI') or IsNumeric(TrimLeft(sDir));
    if not Result then begin
       Exit;
    end;     

  end;

Commenting this part to make it work like in older versions

    if sDir = '  <DI' then begin   {do not localize}
        sDir := Copy(SData, 27, 5);
      end;

{ else begin
        sDir := Copy(SData, 26,28);  <---------------BAD PASRSING
        Result := TextStartsWith(sDir,'  <DI') or IsNumeric(TrimLeft(sDir));
        if not Result then begin
           Exit;
        end;     

  end;}

Showuld solve your problem. Don't know why this change was introduced, though.

cobian
Thanks, will try
Lobuno
WORKS LIKE A CHARM! THANKS!!
Lobuno
A new verson of IdFTPListParseWindowsNT has been checked in, can you verify whether the problem has been fixed?
Remy Lebeau - TeamB