> I've got a problem with VCL component for C++ Builder: TIdFTPServer.
> Does anybody know, how to prepare a directory listing for requesting FTP
> clients (OnListDirectory event)?
The OnListDirectory provides you with the full path that you're supposed to
be listing. You're supposed to then enumerate that folder and add the
appropriate items to the ADirectoryListing parameter of the event. For
example:
void __fastcall TForm1::IdFTPServer1ListDirectory(TIdFTPServerThread
*ASender, AnsiString APath, TIdFTPListItems *ADirectoryListing)
{
TSearchRec sr;
if( FindFirst(APath + "*.*", faAnyFile, sr) == 0 )
{
do
{
if( sr.Name == "." || sr.Name = ".." )
continue;
TIdFTPListItem *Item = ADirectoryListing->Add();
if( sr.Attr & faDirectory )
Item->ItemType = ditDirectory;
else
Item->ItemType = ditFile;
Item->FileName = sr.Name;
Item->Size = sr.Size;
Item->ModifiedDate = FileDateToDateTime(sr.Time);
}
while( FindNext(sr) == 0 );
FindClose(sr);
}
}
> This question is sent to few news-groups, so please answer only once
Please do not cross-post. It is against Borland's newsgroup guidelines.
Only post questions to the single most appropriate group.
Gambit
> Please do not cross-post. It is against Borland's newsgroup guidelines.
> Only post questions to the single most appropriate group.
Sorry, I didn't know about ...components.using group. Now I know :)
Regards,
Egon