Filesize of a file available in FTP Folder

How to fetch the filesize of a file available in a FTP Folder.

Hi, Bhavani.

Using FTP, there is no easy way to get a filesize (i.e. there is no FTP command getsize).

Most FTP clients include the total file size in the first few packets. You could try to capture this information somehow (although I don’t know how).

Are you able to perform UNIX commands on the directory or log in using a different protocol?

Hi folks,
Finally we could get the filesize of a file in a FTP Folder

Use the QUOTE service of the FTP with input for “string” as
SIZE <filename>

Output
Size of the file is available in the return message in the following format

213 <size>

213 is the return code, probably one can fetch the size by taking the substring of return message.

Cheers!

Hi, Bhavani. Thanks for keeping us in the loop on this. Well, <ahem> thanks for keeping me the loop, too. :slight_smile:

[url=“http://www.landfield.com/wu-ftpd/mail-archive/wuftpd-questions/2000/Oct/0122.html”]http://www.landfield.com/wu-ftpd/mail-archive/wuftpd-questions/2000/Oct/0122.html[/url] supports your findings.

For those who wish to explore, the W3C FTP RFC can be reviewed at [url=“RFC 959: File Transfer Protocol”]http://www.w3.org/Protocols/rfc959[/url]. The SIZE command is not specifically mentioned, so be sure to test fully in your own environment.

Thanks again, Bhavani.