这篇文章主要介绍了python 实现自动远程登陆scp文件实例代码的相关资料,需要的朋友可以参考下
python 实现自动远程登陆scp文件实例代码
实现实例代码:
#!/usr/bin/expect if {$argc!=3} { send_user "Usage: $argv0 {path1} {path2} {Password}\n\n" exit } set path1 [lindex $argv 0] set path2 [lindex $argv 1] set Password [lindex $argv 2] spawn scp ${path1} ${path2} expect { "Password:" { exec sleep 1 send "${Password}\r" } "*continue connecting*" { exec sleep 1 send "yes\r" expect "*Password:" { exec sleep 1 send "${Password}\r" } } } expect "*" send "exit\r" expect "*closed*" #send "exit\r" #expect "*" #exit #exec sleep 10
登录后复制
【相关推荐】
1. 特别推荐:“php程序员工具箱”V0.1版本下载
2. Python免费视频教程
3. Python基础入门教程
以上就是python 远程登陆scp文件的方法教程的详细内容,更多请关注Work网其它相关文章!