FTPServer List of Files Does Not Send to Client. Why ?

Giganews Newsgroups
Subject: FTPServer List of Files Does Not Send to Client. Why ?
Posted by:  Edward (eduglobo20…@globo.com)
Date: Wed, 22 Mar 2006

Why the client are not receive the List of files ?

That is my code:

void __fastcall TForm1::IdFTPServer1ListDirectory(TIdFTPServerThread
*ASender, const AnsiString APath, TIdFTPListItems *ADirectoryListing)
{
  TSearchRec sr;
  int iAttributes = 0, ct=0;
  String ADirectory;
  ADirectory = ASender->HomeDir + APath;

  if (FindFirst( AnsiString("*.*"), iAttributes, sr) == 0)
  {
    ADirectoryListing->Add();
    ADirectoryListing->Items[ct]->FileName = sr.Name;
    ADirectoryListing->Items[ct]->Size = sr.Size;
    ADirectoryListing->Items[ct]->ModifiedDate =
FileDateToDateTime(sr.Time);
    if(sr.Name.SubString(1,1) == "." || sr.Name.SubString(1,2) == "..")
    {
      ADirectoryListing->Items[ct]->ItemType + ditDirectory;
    }
    else
    {
      ADirectoryListing->Items[ct]->ItemType + ditFile;
    }
  }
  while(FindNext(sr) == 0)
  {
    ct++;
    ADirectoryListing->Add();
    ADirectoryListing->Items[ct]->FileName = sr.Name;
    ADirectoryListing->Items[ct]->Size = sr.Size;
    ADirectoryListing->Items[ct]->ModifiedDate =
FileDateToDateTime(sr.Time);
    if(sr.Name.SubString(1,1) == "." || sr.Name.SubString(1,2) == "..")
    {
      ADirectoryListing->Items[ct]->ItemType + ditDirectory;
    }
    else
    {
      ADirectoryListing->Items[ct]->ItemType + ditFile;
    }
  }
  FindClose(sr);
}

Edward

Replies