Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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.
Posted
Comments
Prasad Khandekar 1-Apr-13 7:32am    
Use LIST command, the response includes the file name and size and more.
Sergey Alexandrovich Kryukov 1-Apr-13 14:01pm    
Right. I provided more detailed answer, please see.
—SA
Sandeep Mewara 1-Apr-13 11:45am    
And what have you tried so far?

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
 
Share this answer
 
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[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900