Link to home
Start Free TrialLog in
Avatar of saltacid
saltacid

asked on

FTP file size

I have developed small FTP program. Currently, I just download the file without details info of the files.
My question is how to get the size of the file to be downloaded and the size of file after  downloaded?
Avatar of mark2150
mark2150

The LS command will give you a directory of the remote system. All the info you need should be in there. Once the file is local getting the filesize is just the FileLen command or LOF() if the file is open.

M
ASKER CERTIFIED SOLUTION
Avatar of GeorgeK
GeorgeK

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
send "QUOTE SIZE filename" to the remote FTP Server.

It will respond with a 213 message that has the filesize in bytes.  for example, the file you are going to download is called TFILE and is 524 bytes long... You send "QUOTE SIZE TFILE" and the server will return:

213 524


Cheers!
I tried to use Send command with Inet1.execute. But I do not know how to catch the returned values. Could you please give an example with complete command.
-Raju
There is a great free control that will do alot of this, and more, (such as status of the dowload, great for larger files.) Go to http://www.fp.gvn.net/bradley/xFtp/xftpprod.htm

I have no personal stake in it, but it beats the M$ Inet control hands down.

Lookes tobe the above site inaccessible
Sorry, There seems to be a problem with his server. If you want, I can e-mail some info.
Avatar of saltacid

ASKER

Thank you for the answer,
but I'm looking for an example how to use those commands...
such as SIZE, QUOTE...
saltacid,
   I would like to know how you are communicating with the FTP server. I am using a control by a company called Catalyst. It is good but I am still having difficulties myself.

    The Catalyst control I am using allows me to send text messages to the remote FTP host via an FTP port so my code would like;
'Login code
' lots of code here

'Send size request to FTP server here
strMsg = "SIZE /user/saltacid/tst.txt"
ClientSocket.SendLen = len(strMsg)
ClientSocket.SendData = strMsg

    What I am trying to say, if you have established a data connection to an FTP server you should be able to send it a request message, that is "SIZE filename" but if you are using a high level FTP control then it may have a particular command set which maybe SIZE is not a support command.

   So, please if you have written an FTP program, how does it communicate to the FTP server (if it is a client) or the FTP client (if it is a server that you have written. Then maybe I could suggest something specific.

    As for QUOTE, I have not seen this command.