Obtaining statistics for Net::FTP transfers

By: Varghese Chacko 1 year, 3 months ago

With Net:FTP for uplink and downlink file transfers, we may have problems with obtaining the same statistics that are provided by ftp when you perform a manual transfer, i.e file size, transfer duration and transfer speed in KBs. The easiest solution is to print the $ftp->message;  It contain some message. For example,


use Net::FTP;

$ftp = Net::FTP->new("mysite.com", Debug => 0);
print $ftp->message,"\n";
print $ftp->message,"\n";
print $ftp->message,"\n";

This will output

User myusr logged in.

CWD command successful

Opening ASCII mode data connection for myfile.pdf (10816217 bytes)
Transfer complete

Here we gets out put in bytes