递归下载FTP服务器文件  

//伪代码

void DownLoadFtpDiretoryFile(string ftpPath, string LocalPath)

        {

            if (ftpPath is file)//文件直接下载

            {

                m_ftpAdapter.Download(ftpPath, LocalPath);

                return;

            }

            else

            {

                if (Directory.IsExists(LocalPath))//服务器文件夹,先确认本地文件夹是否存在

                {

                    Directory.CreateDirectory(LocalPath);

                };

            }

            List<string> listFileName = new List<string>();

            m_ftpAdapter.GetFileList(listFileName);            

    //遍历ftpPath下的文件

            foreach (string strFileName in listFileName)

            {

                if (IsDiretory(strFileName ))//是文件夹就递归

                {

                    DownLoadFtpDiretoryFile(strFtpChildFilePaht, strLocalChildFilePaht);

                }

                else

                {

    //是文件,直接下载

                    m_ftpAdapter.Download(strFtpChildFilePaht, strLocalChildFilePaht);

                }

            }

        }

 

posted on 2014-11-11 18:34 xuqi 阅读(183) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


<2014年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

导航

统计

常用链接

留言簿

随笔档案

搜索

最新评论

阅读排行榜

评论排行榜