Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# FTP
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 31-Mar-13 23:04pm
Comments
Prasad Khandekar at 1-Apr-13 7:32am
   
Use LIST command, the response includes the file name and size and more.
Sergey Alexandrovich Kryukov at 1-Apr-13 14:01pm
   
Right. I provided more detailed answer, please see.
—SA
Sandeep Mewara at 1-Apr-13 11:45am
   
And what have you tried so far?
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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[^]
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 329
1 Maciej Los 290
2 Sergey Alexandrovich Kryukov 230
3 Shweta N Mishra 185
4 PIEBALDconsult 149
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 8 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100