File: ftp.expect.MASTER

package info (click to toggle)
exmh 1:2.9.0-1
  • links: PTS
  • area: main
  • in suites: buster
  • size: 4,216 kB
  • sloc: tcl: 38,046; perl: 1,647; makefile: 130; sh: 101; exp: 75; csh: 9; sed: 2
file content (25 lines) | stat: -rwxr-xr-x 501 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/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)@"

set timeout 60
spawn ftp $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>*"
send "get $theirname $myname\r"
expect "*550*ftp>*" {exit 1} "*200*226*ftp>*"
close
wait
send_user "FTP transfer ok\n"
exit 0