Home Forums ActiveX components Xceed FTP for ActiveX List all files on Ftp-Server

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • User (Old forums)
    Post count: 23064
    #42806 |



    how can i list all files on a ftp-server?

    include sub-folders…



    Imported from legacy forums. Posted by Thorsten (had 3698 views)

    Xceed Support
    Post count: 5658

    Hi Thorsten,

    you could use the method GetFiles (http://doc.xceedsoft.com/products/XceedFileSystem/Xceed.FileSystem~Xceed.FileSystem.AbstractFolder~GetFiles(Boolean,Object%5B%5D).html) of the AbstractFolder with the Boolean recursive  parameter set to true in order to get the list of all files on the FTP server including the sub folders.

    For instance, you could modify the code snippet of Xceed Software samples as follow:


    FtpConnection connection = new FtpConnection( hostname ) )


    // You can begin with the starting folder by using the FtpFolder

    // constructor that only takes an FtpConnection.

    AbstractFolder rootFolder = new FtpFolder( connection );


    Console.WriteLine( “The starting folder on {0} is ‘{1}’.”,

    hostname, rootFolder.FullName );


    // You can access subfolders by asking any folder for a relative name

    AbstractFolder firstFolder = rootFolder.GetFolder( firstRelativePath );


    Console.WriteLine( “You are now in ‘{0}’.”, firstFolder.FullName );


    AbstractFolder secondFolder = firstFolder.GetFolder( secondRelativePath );

    Console.WriteLine( “And now in ‘{0}’.”, secondFolder.FullName );

    // When you know the exact full path of a folder, you can directly create

    // a new FtpFolder with that path.

    AbstractFolder absoluteFolder = new FtpFolder( connection, absolutePath );


    Console.WriteLine( “And finally in ‘{0}’.”, absoluteFolder.FullName );


    // Very important: Though we just created many instances accessing

    // different folders on this FTP server, the FTP FileSystem hides the

    // complexity of remembering the “current folder”, as you need to do

    // when using a client-style interface. As you can see, each and every

    // instance created above are fully accessible.

    Console.WriteLine( “*** rootFolder variable ***” );


    foreach( FileSystemItem item in rootFolder.GetFiles(true) )


    Console.WriteLine( ” {0}”, item.

    FullName );




    Imported from legacy forums. Posted by Mohamed [Xceed] (had 4663 views)

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.