FtpWebRequest reqFTP;
                    List<String> tempFile = new List<string>();
                    List<String> tempXml = new List<string>();
                    reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri(uristring)); //ftppath + "/" + filename));
                    reqFTP.UseBinary = true;
                    reqFTP.Credentials = new NetworkCredential(_account, _pwd);
                    reqFTP.Method = WebRequestMethods.Ftp.ListDirectory;
                    WebResponse response = reqFTP.GetResponse();
                    StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
                    //获取职位
                    string line = reader.ReadLine();
                    //遍历所有文件,把xml和文件夹分别放入相应数组里面
                    while (line != null)
                    {
                        if (line.ToUpper().EndsWith(".XML"))
                        {
                            tempXml.Add(line.ToUpper());
                        }
                        else
                            tempFile.Add(line);
                        line = reader.ReadLine();
                    }
                    reader.Close();
                    response.Close();

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-21
  • 2021-05-17
  • 2021-08-23
  • 2022-12-23
猜你喜欢
  • 2021-07-26
  • 2021-09-26
  • 2021-11-17
  • 2021-10-27
  • 2021-10-19
  • 2022-12-23
相关资源
相似解决方案