IdFtp1.ChangeDir('/');
IdFtp1.List(nil);
为何IdFtp1.DirectoryListing.Count总为0,根目录小是有文件的!

解决方案 »

  1.   

    IdFtp1.List(nil)是错误的!
    List返回列表的!
    没看文档的么?汗~~List(Alist)
    结果在AList中的!
      

  2.   

    我是想通过DirectoryListing.Items得到文件目录结构信息!
      

  3.   

    这样就可以将远程目录结构返回到memo1procedure TForm1.Button1Click(Sender: TObject);
    begin
    IdFtp1.Connect();
    IdFtp1.ChangeDir('/');
    IdFtp1.List(memo1.Lines);
    end;结果为:(linux ftp服务器)
    total 100
    drwxr-xr-x    2 root     root         4096 Jan 11  2003 bin
    drwxr-xr-x    2 root     root         4096 Jan  1 14:51 boot
    drwxr-xr-x    6 root     root        36864 Jan  1 14:52 dev
    drwxr-xr-x   26 root     root         4096 Jan  1 14:52 etc
    drwxr-xr-x    4 root     root         4096 May 21  2003 home
    ...