SFTPを介してFTPサイトに接続する方法を知る必要があります。私は使用SharpSSH
していますが、プログラムを実行するための例を見つけることができません。
SharpSSH
.DLL
今のところ、ファイルをダウンロードして参照として追加しました。次に、接続できるコードを記述し、FTPサーバーからファイルをアップロード/ダウンロードする必要があります。
これどうやってするの ?ヘルプ。
アップデート
コード:
//ip of the local machine and the username and password along with the file to be uploaded via SFTP.
FileUploadUsingSftp("http://Some-sftp-site.com", "username", "password", @"D:\", @"name.txt");
上記のコードはMainメソッドにあります。
それで ;
private static void FileUploadUsingSftp(string FtpAddress, string FtpUserName, string FtpPassword, string FilePath, string FileName)
{
Sftp sftp = null;
try
{
// Create instance for Sftp to upload given files using given credentials
sftp = new Sftp(FtpAddress, FtpUserName, FtpPassword);
// Connect Sftp
sftp.Connect();
// Upload a file
sftp.Put(FilePath + FileName);
// Close the Sftp connection
sftp.Close();
}
finally
{
if (sftp != null)
{
sftp.Close();
}
}
}