> how to get the size of the file will be downloaded from the ftp 
> server to make a progressbar in onProgress event?

There are several ways of finding the size of a file, depending on which
commands the FTP server supports.  The easiest is MLST which gets size and time
stamp for a single file, if not try MDTM which is similar, next LIST with a
file name argument may return a single file, but not on all servers, so finally
you LIST the whole directory and find the single file you care about, after
parsing the directory listing, that maybe in several different formats.  

The much faster way is download the free Magenta Systems File Transfer

and use the TMagFtp component which is a high level FTP component hiding all
the differences between FTP servers from you, and allowing you to download or
uploaded hundreds of files, including sub-directories, with a single command.  

There is a single function that does exactly what you need:

function TMagFtp.FtpCheckFile (const RemDir, RemFile: string ; var FSize: Int64;
var FileUDT: TDateTime): boolean;

and another that will download a single file, providing a progress event with
percentage done and estimating time left to complete. 

function TMagFtp.FtpDownOneFile (const FdirSrc, Fnamesrc, Fnametar: string ;
Replopt: TFileCopyRepl) : TTaskResult ;

When downloading multiple files, the progress event gives details for both the
current file and the whole job. 


To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to