>Does anyone have any suggestions for an SFTP client for .NET?
>
>I've seen a few, but would appreciated any recommendations.
Here's the one I use:
https://github.com/sshnet/SSH.NETCode sample (I used this code to download a file from the FTP server and store it on my local machine):
class Program
{
static void Main(string[] args)
{
string keyFile = @"c:/path-to-your-ppk-file/blah_private.ppk_openssh";
string passPhrase = "your-passphrase";
PrivateKeyFile privateKeyFile = new PrivateKeyFile(keyFile, passPhrase);
string host = @"123.123.123.123";
int port = 22;
string username = "root-user-name";
string remoteFilename = @"/root/path-to-file/filename-to-download.ext";
string localFilename = string.Format("Development-{0:yyyy-MM-dd_hh-mm-ss-tt}.ext", DateTime.Now);
localFilename = @"c:\users\Billy\download-path\" + localFilename;
using (var sftp = new SftpClient(host, port, username, privateKeyFile))
{
sftp.Connect();
using (var file = File.OpenWrite(localFilename))
{
sftp.DownloadFile(remoteFilename, file);
}
sftp.Disconnect();
}
}
}