从ftp服务器获取文件信息c# [英] get file information from ftp server c#

查看:114
本文介绍了从ftp服务器获取文件信息c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要在单个请求中获取文件名和文件大小。请告诉我该怎么做?我只得到文件名。

Hi,
I need to get file name and file size in single request.Pls tell me how to do that? i am getting only file name.

推荐答案

你可以使用类 System.Net.FtpWebRequest

http://msdn.microsoft.com/en-us/ library / system.net.ftpwebrequest.aspx [ ^ ]。



查看您可以发出的所有请求方法: http://msdn.microsoft.com/en-us/library/system.net.webrequestmethods.ftp.aspx [ ^ ]。



-SA
You can use the class System.Net.FtpWebRequest:
http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest.aspx[^].

Look at all the request methods you can issue: http://msdn.microsoft.com/en-us/library/system.net.webrequestmethods.ftp.aspx[^].

—SA


WebRequestMethods.Ftp.GetFileSize失败,错误550:SIZE不允许进入ASCII模式。



显然没有让FtpWebRequest在SIZE之前发送TYPE I命令的方法。



http://social.msdn.microsoft.com/Forums/en-US/0c38814e-d8e3-49f3-8818-b5306cc100ce / ftpwebrequestusebinary-does-not-work [ ^ ]
WebRequestMethods.Ftp.GetFileSize fails with error 550: SIZE not allowed in ASCII mode.

Apparently there is no way to make the FtpWebRequest to send the TYPE I command before the SIZE.

http://social.msdn.microsoft.com/Forums/en-US/0c38814e-d8e3-49f3-8818-b5306cc100ce/ftpwebrequestusebinary-does-not-work[^]


这篇关于从ftp服务器获取文件信息c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆