Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Indy TIdpFTPServer VCL

33 views
Skip to first unread message

Remy Lebeau (TeamB)

unread,
Jan 21, 2003, 11:57:58 PM1/21/03
to
"Egon" <bcb@[ANTY_SPAM]egon.5u.com> wrote in message
news:3e2d...@newsgroups.borland.com...

> 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


Egon

unread,
Jan 22, 2003, 3:29:36 AM1/22/03
to
Thank You very much!

> 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


0 new messages