Click here to Skip to main content
15,917,645 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.

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

1) Request a list of files and folders in the target folder
2) Download each file separately.
3) Repeat 1) and 2) for the subfolders.
Share this answer
sethupathiram 14-Oct-11 7:38am    
Plzzz tell the logic How do need to write the function.
Simon Bang is totally right.
Anyway, I use the following recursive approach (which is pretty much the same)
(keep in mind that this is just sample code to illustrate the logic):
public void DownloadFtpFolder(string ftpFolderPath)
    FtpFolder fo = new FtpFolder(folderPath);
    foreach (FtpFile fi in fo.FtpFiles)
    foreach (FtpFolder f in fo.FtpFolders)
public void DownloadFtpFile(string ftpFilePath)
    // download the file here

You need a ftp library for downloading the actual files and navigating the folders, but I hope this illustrates how this could be done theoratically.

Share this answer
sethupathiram 15-Oct-11 0:51am    
Hi Could you plzz share me that ftp library files.
hoernchenmeister 17-Oct-11 2:27am    
We use a commercial library called IpWorks, but this approach applies to pretty much all other libs too.
I am pretty sure you might find a free library using google.

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