PowerTCP FTP for .NET | Get a Directory Listing Code Example

See all PowerTCP FTP for .NET Code Examples

Get a Directory Listing Example

This example demonstrates using the FTP control to obtain a directory listing from an FTP server.

 

Ftp ftp1 = new Ftp();
//Connect and log into the server, and get a listing
ftp1.Connect(myServer);
ftp1.Authenticate(myUsername, myPassword);
Listing listing = ftp1.List("", "", ListType.Full);
//Display each list entriy in the console
foreach (ListEntry entry in listing)
    Console.WriteLine(entry.Text);
//Logout of the server
ftp1.Close();

 

To download a trial please visit the PowerTCP FTP for .NET product page.