c# 获取ftp列表内容
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
FtpWebRequest ftp = (FtpWebRequest)FtpWebRequest.Create("ftp://10.38.129.14:21//home//xy2012"); ftp.Credentials = new NetworkCredential("用户名", "密码"); ftp.Method = WebRequestMethods.Ftp.ListDirectory; WebResponse response = ftp.GetResponse(); StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.Default); string line = reader.ReadLine(); while (line != null) { if (!string.IsNullOrEmpty(line.Trim())) { Console.WriteLine(line); } line = reader.ReadLine(); }
该文章在 2021/3/5 19:01:31 编辑过 |
关键字查询
相关文章
正在查询... |