#!/usr/bin/expect -f set site [lindex $argv 0] set dir [lindex $argv 1] set theirname [lindex $argv 2] set myname [lindex $argv 3] set password "$env(USER)@barco.cz" set timeout 60 spawn ftp -v $site expect "*Name*:*" send "anonymous\r" expect "*Password:*" send "$password\r" expect "*ftp>*" send "binary\r" expect "*ftp>*" send "cd $dir\r" expect "*550*ftp>*" {exit 1} "*250*ftp>*" set timeout -1 send "reget $theirname $myname\r" expect "*550*ftp>*" {exit 1} "*200*226*ftp>*" close wait send_user "FTP transfer ok\n" exit 0