Xceed FTP Library Documentation
Example topics / Getting a remote folder's contents (VB.NET example)
In This Topic
    Getting a remote folder's contents (VB.NET example)
    In This Topic
    VB.NET Copy Code

    Dim ftp As 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.
       Dim folderItems As Object = ftp.GetFolderContents( "", XceedFtpLib.EXFContentsFormat.fcfCollection )

       Dim item As XceedFtpLib.XceedFtpFolderItem
       For Each item in CType( folderItems, XceedFtpLib.XceedFtpFolderItems )
          listBox1.Items.Add( item.ItemName )
       Next item

       ' Disconnect from the FTP server
       ftp.Disconnect()
    Catch except As System.Runtime.InteropServices.COMException
       MessageBox.Show( except.ToString() )
    End Try