#!/usr/bin/expect -f
set ip [lindex $argv 0]
set dir [lindex $argv 1]
set file [lindex $argv 2]
set timeout 10
spawn ftp $ip
expect "Name*"
send "root\r"
expect "Password*"
send "huawei\r"
expect "ftp>*"
send "lcd $dir\r"
expect {
"*file" {send_user "local $dir no such file or dir";send "quit\r"}
"*now*" {send "put $dir/$file d:/serv_u_root/$file\r"}
}
expect {
"*Failed" {send_user "remote $file no such file";send "quit\r"}
"*OK" {send_user "$file has been uploaded.";send "quit\r"}
}
expect eof
expect
最新推荐文章于 2025-08-12 23:45:18 发布