The ftp package allows you to specify a progress monitor callback in the ftp::Open
command:
package require ftp
proc progressMessage {bytesSoFar} {
puts "Transferred $bytesSoFar; looking good..."
}
set handle [ftp::Open $A $user $pass -progress progressMessage]
# Everything after this is just standard for the ftp package
if {$handle < 0} {
error "could not connect"
}
if {![ftp::Get $handle $remoteFile $localFile]} {
ftp::Close $handle
error "could not transfer"
}
ftp::Close $handle
puts "Transfer completed"
This will print a message every time a chunk is transferred (the chunk size is configurable in the options to ftp::Open
via the -blocksize
option; it's 4096 by default). On modern networks, this is probably going to write messages very rapidly…