#!/usr/bin/expect set timeout 3600 set password [lindex $argv 0] set src_file [lindex $argv 1] set dest_file [lindex $argv 2] spawn scp -r $src_file $dest_file expect { "(yes/no)?" { send "yes\n" expect "*assword:" { send "$password\n"} } "*assword:" { send "$password\n" } "*csv" { } }