Click here to Skip to main content
15,940,430 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to download a complete folder with its files from ftp server.

Plz share me if you code and libraries for that...

For Example, there is a folder "hello" with 3 files and 1 directory "subfolder" which has one file in it.

1 solution

This is a pretty simple task, solved by using the classes System.Net.FtpWebRequest and System.Net.WebResponse. Your operation of downloading files from a directory would be a compound operation sequencing getting directory lists followed by a number of file downloading operations, optionally in a recursive manner. Those operations are represented by the static class System.Net.WebRequestMethods.Ftp. The operations you need are System.Net.WebRequestMethods.Ftp.DownloadFile and System.Net.WebRequestMethods.Ftp.ListDirectory or System.Net.WebRequestMethods.Ftp.ListDirectoryDetails.

See MSDN help pages with some code samples:[^],[^],[^].

Having all this information and code samples, you can consider the source code you need is almost done.

Share this answer
Espen Harlinn 15-Oct-11 9:16am    
Good answer :)
Sergey Alexandrovich Kryukov 15-Oct-11 19:45pm    
Thank you, Espen.
Simon Bang Terkildsen 15-Oct-11 18:18pm    
My 5
Sergey Alexandrovich Kryukov 15-Oct-11 19:45pm    
Thank you, Simon.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900