← 記事に戻る
# C#SFTPでダウンロードするプログラムの作り方。

[![](https://zip358.com/wp-content/uploads/2016/12/sftp.jpg)](https://zip358.com/wp-content/uploads/2016/12/sftp.jpg)
 C#SFTPでダウンロードするプログラムの作り方。
 いろいろ調べた結果、こんだけのコードでSFTPでダウンロードする事が
 判明。タダシ!!ライブラリが必要なので下記のリンクからTamir.SharpSSH.dll
 のライブラリを参照してあげてください。そうすることでSFTPのダウンロードが
 可能になります。FTPでの接続方法とかは結構出回っていますが、SFTPの接続プログラムって
 あまり落ちてません。ちなみに、その他のライブラリを使う方法にWinSCPのライブラリを
 使う方法や[SSH.Net](https://github.com/sshnet/SSH.NET)のライブラリを使う方法があります。

```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Tamir.SharpSsh;
namespace ftp
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void button1_Click(object sender, EventArgs e)
        {
            Sftp sftp = new Sftp("192.168.11.1", "id", "pass");
            sftp.Connect();
            sftp.Get("/www/html/hoge.mp4", "C:\\Users\\hoge\\Documents\\hoge.mp4");
            sftp.Close();
            MessageBox.Show("キタ━━━━(゚∀゚)━━━━!!");
        }
    }
}
```



[https://ja.osdn.net/projects/sfnet\_sharpssh/downloads/SharpSSH/1.1.1.13/SharpSSH-1.1.1.13.bin.zip/](https://ja.osdn.net/projects/sfnet_sharpssh/downloads/SharpSSH/1.1.1.13/SharpSSH-1.1.1.13.bin.zip/)

 [ ![](https://zip358.com/wp-content/uploads/2026/01/image-31.png) サイトを分離した話を黙々と書いていきます.

 ](https://zip358.com/2026/02/04/%e3%82%b5%e3%82%a4%e3%83%88%e3%82%92%e5%88%86%e9%9b%a2%e3%81%97%e3%81%9f%e8%a9%b1%e3%82%92%e9%bb%99%e3%80%85%e3%81%a8%e6%9b%b8%e3%81%84%e3%81%a6%e3%81%84%e3%81%8d%e3%81%be%e3%81%99.html) 

 [ ![](https://zip358.com/wp-content/uploads/2026/01/image-30-300x300.png) 半額セールでアドビ様を延長.

 ](https://zip358.com/2026/02/03/%e5%8d%8a%e9%a1%8d%e3%82%bb%e3%83%bc%e3%83%ab%e3%81%a7%e3%82%a2%e3%83%89%e3%83%93%e6%a7%98%e3%82%92%e5%bb%b6%e9%95%b7.html) 

 [ ![](https://zip358.com/wp-content/uploads/2026/01/image-29.png) 何の前触れもなく変えたのは初めてかも.

 ](https://zip358.com/2026/02/02/%e4%bd%95%e3%81%ae%e5%89%8d%e8%a7%a6%e3%82%8c%e3%82%82%e3%81%aa%e3%81%8f%e5%a4%89%e3%81%88%e3%81%9f%e3%81%ae%e3%81%af%e5%88%9d%e3%82%81%e3%81%a6%e3%81%8b%e3%82%82.html) 

 [ ![](https://zip358.com/wp-content/uploads/2023/01/you-300x300.png) 跳ねたいサイトで跳ねたい

 ](https://zip358.com/2026/02/01/%e8%b7%b3%e3%81%ad%e3%81%9f%e3%81%84%e3%82%b5%e3%82%a4%e3%83%88%e3%81%a7%e8%b7%b3%e3%81%ad%e3%81%9f%e3%81%84.html) 

 [ ![](https://zip358.com/wp-content/uploads/2026/01/image-36.png) 映画、機動戦士ガンダム 閃光のハサウェイ キルケーの魔女

 ](https://zip358.com/2026/01/31/%e6%98%a0%e7%94%bb%e3%80%81%e6%a9%9f%e5%8b%95%e6%88%a6%e5%a3%ab%e3%82%ac%e3%83%b3%e3%83%80%e3%83%a0-%e9%96%83%e5%85%89%e3%81%ae%e3%83%8f%e3%82%b5%e3%82%a6%e3%82%a7%e3%82%a4-%e3%82%ad%e3%83%ab%e3%82%b1.html)