Board index » delphi » IdFTP List doesn't retrieve directories

IdFTP List doesn't retrieve directories

I'm using the current developer's version of Indy 9.

When I do an IdFTP.List I get a list of files but no directories are listed
even though I know they exist.

  ServerFiles := TStringList.Create;
  with IdFTP do
    begin
      ChangeDir(EASYWEBFOLDER);
      List(ServerFiles, '*.*', true);
      if DirectoryListing.Count > 0 then
        begin
          ListBox1.Clear;
          //for i := 0 to DirectoryListing.Count - 1 do
          for i := 0 to ServerFiles.Count - 1 do
            ListBox1.Items.Add(DirectoryListing.Items[i].Data);
        end;
    end;
  ServerFiles.Free;

gets a list of every file in the directory but not one subdirectory and
therefore

  if DirectoryListing.Items[i].ItemType = ditDirectory then

fails.  I desperately need to be able to see which subdirectories exist so I
can navigate them so what do I do?

BTW, what's the point of having to declare your own StringList as a
paremeter to List when there's DirectoryListing?

--

Quidquid latine dictum sit, altum videtur.
#319

 

Re:IdFTP List doesn't retrieve directories


try
IdFTP1.List(Memo1.Lines, '', true);
dirctory entrys do not have a dot.

hth Ernst

"DRS" <d...@removethis.ihug.com.au> schrieb im Newsbeitrag
news:3cf73a1f_1@dnews...

Quote
> I'm using the current developer's version of Indy 9.

> When I do an IdFTP.List I get a list of files but no directories are
listed
> even though I know they exist.

>   ServerFiles := TStringList.Create;
>   with IdFTP do
>     begin
>       ChangeDir(EASYWEBFOLDER);
>       List(ServerFiles, '*.*', true);
>       if DirectoryListing.Count > 0 then
>         begin
>           ListBox1.Clear;
>           //for i := 0 to DirectoryListing.Count - 1 do
>           for i := 0 to ServerFiles.Count - 1 do
>             ListBox1.Items.Add(DirectoryListing.Items[i].Data);
>         end;
>     end;
>   ServerFiles.Free;

> gets a list of every file in the directory but not one subdirectory and
> therefore

>   if DirectoryListing.Items[i].ItemType = ditDirectory then

> fails.  I desperately need to be able to see which subdirectories exist so
I
> can navigate them so what do I do?

> BTW, what's the point of having to declare your own StringList as a
> paremeter to List when there's DirectoryListing?

> --

> Quidquid latine dictum sit, altum videtur.
> #319

Re:IdFTP List doesn't retrieve directories


Quote
"Ernst Gerlach" <ernst.gerl...@epost.de> wrote in message

news:3cf7b23a$1_2@dnews...

Quote
> try
> IdFTP1.List(Memo1.Lines, '', true);
> dirctory entrys do not have a dot.

Thanks.

--

Quidquid latine dictum sit, altum videtur.
#319

Re:IdFTP List doesn't retrieve directories


Quote
"Ernst Gerlach" <ernst.gerl...@epost.de> wrote in message

news:3cf7b23a$1_2@dnews...

Quote
> try
> IdFTP1.List(Memo1.Lines, '', true);
> dirctory entrys do not have a dot.

Thanks.

Now for the next problem.  I'm trying to recursively parse my way down the
directory structure.  The problem is of course that each time I go down a
directory DirectoryListing is reset by List so that when I subsequently
ChangeDirUp I get a ListIndex Out Of Bounds error.  However, each instance
of my procedure has its own copy of my StringList, so is there any way of
feeding that back into IdFTP so that the DirectoryListing is reset back to
the way it was before and the loop can keep going or do I have to do a new
List every time (which could be slow)?

--

Quidquid latine dictum sit, altum videtur.
#319

Other Threads