标题:C# FTP 读取一个文件夹的所有文件按创建或者修改顺序排序-怎么做
只看楼主
wrutd
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2013-9-6
 问题点数:0 回复次数:0 
C# FTP 读取一个文件夹的所有文件按创建或者修改顺序排序-怎么做
C# FTP 读取一个文件夹的所有文件按创建或者修改顺序排序-怎么做?急求助
public bool GetFileList(string filePattern, ref string[] fileList, ref string strErr)
        {
            bool bRet = false;
            
            try
            {
                StringBuilder result = new StringBuilder();
                    string uri = "ftp://" + ftpServerIP + ":" + ftpPort;
                    if (ftpDictionary != "") { uri += "/" + ftpDictionary; }
                    uri += "/";

                    strErr = Connect(uri);//连接
                    if (strErr != "")
                    {
                        //dispose
                        return bRet;
                    }

                    reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
                    reqFTP.KeepAlive = false;
                    WebResponse response = reqFTP.GetResponse();
               
               
                    StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.Default);//中文文件名

                    string line = reader.ReadLine();

                    while (line != null)
                    {
                        result.Append(line);

                        result.Append("\n");

                        line = reader.ReadLine();

                    }
                    reader.Close();

                    response.Close();
                    
                    fileList= result.ToString().Spli

}

搜索更多相关主题的帖子: public result 文件夹 false 
2013-09-06 17:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-420207-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.081296 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved