Click here to Skip to main content
11,489,693 members (70,603 online)
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 Sergey Alexandrovich Kryukov 535
1 OriginalGriff 223
2 Andy Lanng 193
3 Maciej Los 190
4 _duDE_ 141
0 Sergey Alexandrovich Kryukov 9,488
1 OriginalGriff 8,425
2 Sascha Lefèvre 3,344
3 Maciej Los 3,066
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web02 | 2.8.150520.1 | Last Updated 8 Jul 2013
Copyright © CodeProject, 1999-2015
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