How to download or upload or delete multiple files from FTP server using C#

  • In this article, I am going to explain how to download or upload or delete multiple files from a directory.
  • If I want to download or upload or delete only text files with “.txt” extension.
  • We can download, upload or delete any file with any extension.
  • I am using GetFiles method to get only the text files present in my directory “MyFolder”.

string[] files = Directory.GetFiles(@”MyFolder”,”*.txt”);

  • Now, I have got all my desired files into the string array where I will loop through each file and download or upload or delete it from FTP server.

foreach (string filepath in files)

{

// here goes the actual code for downloading or uploading or deleting a file from FTP server.

}

  • Here is the code to Download file , Upload file and Delete file from FTP server.

Advertisement

Mục lục bài viết

Share this:

Like this:

Like

Loading…