Advertisement
Guest User

Untitled

a guest
Sep 6th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. string host = "";
  2. string username = "";
  3. string password = "";
  4. string localFileName = System.IO.Path.GetFileName(localFile);
  5. string remoteFileName = "";
  6.  
  7. using (var sftp = new SftpClient(host, username, password))
  8. {
  9.     sftp.Connect();
  10.  
  11.     using (var file = File.OpenWrite(localFileName))
  12.     {
  13.         sftp.DownloadFile(remoteFileName, file);
  14.     }
  15.     sftp.Disconnect();
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement