Getting a remote folder's contents (C# example)
                In This Topic
            
            
| C# |  Copy Code | 
| XceedFtpLib.XceedFtp ftp = new XceedFtpLib.XceedFtpClass();
 ftp.License( @"your license key" );
 
 // Specify the FTP server's address
 ftp.ServerAddress = @"ftp.cdrom.com";
 
 // Specify the username and password to login
 ftp.UserName = "anonymous";
 ftp.Password = "guest";
 
 try
 {
 // Connect to the FTP server
 ftp.Connect();
 
 // Get the root folders contents.
 object folderItems = ftp.GetFolderContents( "", XceedFtpLib.EXFContentsFormat.fcfCollection );
 
 foreach( XceedFtpLib.XceedFtpFolderItem item in ( XceedFtpLib.XceedFtpFolderItems )folderItems )
 {
 listBox1.Items.Add( item.ItemName );
 }
 // Disconnect from the FTP server
 ftp.Disconnect();
 }
 catch( System.Runtime.InteropServices.COMException except )
 {
 MessageBox.Show( except.ToString() );
 }
 
 |