c# 獲取ftp列表內(nèi)容
當(dāng)前位置:點晴教程→知識管理交流
→『 技術(shù)文檔交流 』
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 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |