C#如何判断远程目录(FTP服务器)是否存在?
程序员文章站
2022-06-10 20:28:27
...
参考地址:http://www.ggat.cn/newsInfo.html/129
var request = (FtpWebRequest)WebRequest.Create(”ftp://ipaddress//dir");request.Credentials = new NetworkCredential("user", "pass");request.Method = WebRequestMethods.Ftp.GetFileSize; try{ FtpWebResponse response = (FtpWebResponse)request.GetResponse();}catch (WebException ex){ FtpWebResponse response = (FtpWebResponse)ex.Response; if (response.StatusCode == FtpStatusCode.ActionNotTakenFileUnavailable) { //不存在 }}
转载于:https://my.oschina.net/u/3740241/blog/1583720
上一篇: Gradle高級配置
下一篇: HDMI测试数据