我正在使用Paramiko的SFTPClient在主机之间传输文件.我希望我的脚本打印文件传输进度类似于使用scp看到的输出.
$ scp my_file user@host
user@host password:
my_file 100% 816KB 815.8KB/s 00:00
$
Run Code Online (Sandbox Code Playgroud)
任何的想法?
提前致谢
Spe*_*bun 23
使用put函数的可选回调参数.像这样的东西:
def printTotals(transferred, toBeTransferred):
print "Transferred: {0}\tOut of: {1}".format(transferred, toBeTransferred)
sftp.put("myfile","myRemoteFile",callback=printTotals)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6919 次 |
| 最近记录: |