Sample: GetPut - FTP Download/Upload
A utility for uploading and downloading files using FTP.
C#
// create Ftp object, connect and log in
Ftp ftp = new Ftp();
ftp.Connect (hostname);
ftp.Login (username, password);
// download file and display number of bytes transferred
long bytes = ftp.GetFile (remotePath, localPath);
Console.WriteLine ("Transfered {0} bytes.", bytes);
// disconnect
ftp.Disconnect();
VB.NET
' create Ftp object, connect and log in
Dim ftp As New Ftp()
ftp.Connect(hostname)
ftp.Login(username, password)
' set transfer type to binary
ftp.SetTransferType(FtpTransferType.Binary)
' download file and display number of bytes transferred
Dim bytes As Long = ftp.GetFile(remotePath, localPath)
Console.WriteLine("Transfered {0} bytes.", bytes)
' disconnect
ftp.Disconnect()
See also: