-2

I want to download A ftp directory which has its sub directories and files, I am using C# Ftpwebrequst.

user2155670
  • 9
  • 1
  • 1

2 Answers2

1

There is no way to directly download an entire folder in a single command. FTP does not support this. You would need to enumerate through all files in the directory and their subdirectories and download files one-by-one.

Here is a thread from MSDN forums and here is the documentation on FtpWebRequest-class from MSDN.

bash.d
  • 13,029
  • 3
  • 29
  • 42
0

I think you need something like this and you will have to recurse into each folder inidividually:

    WebRequest request = WebRequest.Create(FTPServerDirectory);
            request.Method = WebRequestMethods.Ftp.ListDirectory;
            request.Credentials = new NetworkCredential(Username, Password);
            request.GetResponse();
Damo
  • 361
  • 4
  • 16