Re: Ftp.List() - Option to just retrieve directories?

Giganews Newsgroups
Subject: Re: Ftp.List() - Option to just retrieve directories?
Posted by:  DonS (mudsha…
Date: Wed, 23 Mar 2005

> I am currently working with C# and Indy 9.

If you're using C#, you have to be using Indy 10.  The Indy assembly may say IndySystem90.dll, but the 90 is a compiler version.  Check the contents of the lib\system\IdVers.Inc file.

> I am trying to use recursion in
> conjunction with the pattern matching ability of List() to only retrieve the
> actual directories  in any given directory. I saw somewhere DirItemType
> could be used... I apologize in advance for not fully understanding the
> documentation. Any assistance would be greatly appreciated. Is there a
> method that retrieves just the directories?

Not really - FTP doesn't standardize file system info (unless you're talking specifically about a server that supports MLSD and MLST).  Indy has parsers that attempt to parse the results from LIST and NLST.  You can access the results of that effort in the DirectoryListing property.  Each entry in the collection has an ItemType value that indicates what the parser thought the entry represented.

    // it's a directory
    (IdFtp.DirectoryListing.Items[i].ItemType = ditDirectory)
    // it's a file
    (IdFtp.DirectoryListing.Items[i].ItemType = ditFile)




In response to

Ftp.List() - Option to just retrieve directories? posted by Dirk Honda on Wed, 23 Mar 2005