About idFTP and .LIST member

Giganews Newsgroups
Subject: About idFTP and .LIST member
Posted by:  Loris Luise (loris.lui…@tiscali.it)
Date: Wed, 12 Nov 2008

Hello,

i've got a question about idFTP class/component.

I use this command

ftpMain.List(NIL, '*.PDF' ); //ftpMain is a idFTP class oject

to have returned a directory listing form the ftp server
of all files with PDF extension.

Is that right?

if it is,
there is an issue.... in a case where
ftp server supports MLSD command (in the feature list,
for example Filezilla server, ZFTP server, and maby other i think)

then  ASpecifier parameter of

procedure TIdFTP.List(ADest: TStrings; const ASpecifier: string = '';
ADetails: Boolean = True);      {do not localize}

is completely ignored because of this

procedure TIdFTP.List(ADest: TStrings; const ASpecifier: string = '';
ADetails: Boolean = True);      {do not localize}
var
  LDest: TMemoryStream;
  LTrans : TIdFTPTransferType;
begin
  if FCanUseMLS then begin
    ExtListDir(ADest);
    Exit;
  end;
.....

FCanUseMLS is true and listing is populated in a different way ignoring
Aspecifier and this returning a FULL LISTING of cur dir that isn't what
i'm expecting (i specified a file mask)

So i modified like this
procedure TIdFTP.List(ADest: TStrings; const ASpecifier: string = '';
ADetails: Boolean = True);      {do not localize}
var
  LDest: TMemoryStream;
  LTrans : TIdFTPTransferType;
begin
  if FCanUseMLS and (ASpecifier = '') then begin
    ExtListDir(ADest);
    Exit;
  end;
.....

to override MLST use in a case where Ascpecifier is not null string.

Well,

i'm asking Indy's gurus if what i'm doing is right or
if it can resolved in a different or better way...

thanks...

Replies