Similar Threads:
1.expect:ftp:downloading new files from a huge ftp account
Hi all,
I have a remote ftp account to a directory with 40 GO of files in a
tree of directories.
I have a list of 175000 path/filenames coming from that ftp account
(same arborescence).
I would like to write an expect script that connect to the ftp account,
browse the three and get all files that are not in my list.
does anybody ever write such a script or knows where to find infos that
could help me.
many thanks
2.Expect script to manage FTP
I'm running HP-UX 11i with Expect installed. I'd prefer not to install
any other software.
I need to visit multiple FTP sites, send and receive files from each
site, and delete successfully downloaded files from the source FTP
sites, and archive successfully uploaded files on my site.
I have some experience using Expect to automate FTP, but it's been
limited to simple put and get transactions, with no need to delete or
archive files. Typically I write an expect script for each FTP site I
want to visit, and manage everything but the FTP in a shell script. I'm
comfortable with that model, but also open to other suggestions.
Thanks for taking the time to read this, and for any suggestions.
Here's what I have so far:
#! /usr/local/bin/expect
spawn ftp -i ftp.somesite.com
expect "root): "
send "FTPUSER\r"
expect "assword:"
send "mypassword\r"
expect "ftp> "
send "cd Outgoing/Prod\r"
expect "ftp> "
send "lcd /var/EDI/somesite/IN\r"
expect "ftp> "
send "binary\r"
expect "ftp> "
send "mget *.pgp\r"
expect -timeout 999 "ftp> "
send "lcd /var/EDI/somesite/OUT\r"
expect "ftp> "
send "cd ../../Incoming/Prod\r"
expect "ftp> "
send "mput *.pgp\r"
expect -timeout 999 "ftp> "
expect "ftp> "
send "bye\r"
3.FTP using expect
Hello,
I am new to Expect.( This is a very basic expect program, please let me
know if there is a
separate group where I can post this query)
I am simply trying to ftp my local mail server , entering username and
password read from a file and then exitting.
Sometimes this program runs fine till the end and exits properly, but
sometimes it hangs in between. Like sometimes after entering user name
, or sometimes after entering passowrd or sometimes during ftp to the
server.
Following is the program, please let me know if there is something
wrong with the program.
I tried it on various server and even tried telnet program but face the
same problem.
#!c:/Tcl/bin/tclsh
package require Expect
spawn ftp indmail
set timeout -1
set file [open "C:/Tcl/bin/password.txt" "r"]
gets $file username
gets $file password
expect "User*"
send "$username\r"
expect "Password:"
send "$password\r"
expect "ftp>"
send "binary\r"
expect "ftp> "
send "bye\r"
4.Expect: sending larger files with ftp-inband
5.[Expect] Get, then move files within FTP site
M Bourgon wrote:
> Trying to do the following, and it looks like Expect is probably my
> best bet. Any help greatly appreciated
>
> 1) Log onto ftp site
> 2) Go to folder
> 3) GET all files matching basename*.txt
> 4) MOVE those files to a subfolder on the ftp site. I don't need to
> move it on MY computer, I want to move the files on the site to a
> subfolder, so that if there are any problems the files are still
> accessable. This is acceptable by the site owner.
>
> I'm not sure how to get it to evaluate from the responses - ideally
> I'd do a LIST, stick that in some sort of array, then loop through and
> do a GET then RENAME.
>
> Example:
> spawn ftp myftp
> expect "username:"
> send "hi\r"
> expect "password:"
> send "mom\r"
> expect "ftp>"
> send "prompt\r"
> expect "ftp>"
> send "cd getme\r"
> expect "ftp>"
> send "mget basename*.txt\r"
> expect "ftp>"
> (code I need - move all files I just got to folder getme\processed)
> send "bye\r"
> expect eof
<apology>
I hate it when people do this. My excuse is that you don't sound as
though your are certain that expect is your best bet for this task.
</apology>
Have you looked at the ftp package in tcllib? It looks to me as though:
set chn [ftp::Open site username password]
ftp::Cd $chn wherever
foreach file $files [ftp::List $chn basename*.txt] {
ftp::Rename $chn $file somewhereElse
}
ftp::Close $chn
should come pretty close to what you're after.
--
Alan
6. [Expect] Get, then move files within FTP site?"
7. Permission to FTP to ftp.taygeta.com/
8. Active State base-tcl8 vfs::ftp Error can't find package ftp