Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Mar 13th, 2018 60 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. using System.Net;
  7. using System.IO;
  8.  
  9. namespace SimpleFTPDownload_CLI
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             FTP_Download("ftp://muttismodemaus.mu.funpic.de/CIMG2824.JPG", Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + @"\CIMG2824.JPG", "muttismodemaus", "lenaundsusi");
  16.         }
  17.  
  18.         public static bool FTP_Download(string Remote, string Local, string UserName, string Password)
  19.         {
  20.             WebClient Request = new WebClient();
  21.             Request.Credentials = new NetworkCredential(UserName, Password);
  22.  
  23.             try
  24.             {
  25.                 byte[] BinaryData = Request.DownloadData(Remote.ToString());
  26.                 FileStream File = new FileStream(Local, FileMode.Create, FileAccess.Write);
  27.                 File.Write(BinaryData, 0, BinaryData.Length);
  28.                 File.Close();
  29.             }
  30.             catch
  31.             {
  32.                 return false;
  33.             }
  34.  
  35.             return true;
  36.         }
  37.     }
  38. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top