Click to See Complete Forum and Search --> : REAL NEWBIE: hdiu FTP?


oxygen
11-06-2001, 05:33 AM
uhhmmmmm... hi... my name is oxygen - and i am the new one. ;-)

No seriously: hdiu stands for "how do i use"....

Now: I want to work ftp directly from the command-line - i dont want to get into the program with its own command line - i want to do it from bash... (repetition is a good way of making a point, right ;-) )

That what i want to do: login to a ftp-server (account/pass provided), the upload a predefined file like dummy.txt which sits in the directory, i start the command in. What is the command i have to use? I have already looked into the Howtos or LDP, but they only describe how to use ftp "from inside".

THANKS FOR YOUR HELP!!!

cu around,

ox

DMR
11-06-2001, 06:36 AM
You'll have to fire up the ftp executable at some point; what's the big deal about that?
If you want to automate things, it looks like you could have shell scripts which would basically consist of customized invocations of the ftp command, each passing different arguments to the program. I'm not sure how flexible that would be, but it would work in a limited way.

oxygen
11-06-2001, 07:20 AM
thanks for your answer!

Now... I want to do this because i want to automize a service that sends a certain file automatically every half hour or so (my ip) to a specified host with pass and account

Now, i figured out, that i have to use the cron service for automation, but there, i have to enter a simple command - which i couldnt figure out yet...

- now - if you respond - please expect me to be a complete /dev/null about linux. I don't know my way around yet. it would be great if you could give *specific* commands or "go there, look there"-advice.

THANKS AGAIN!
ox

jumpedintothefire
11-07-2001, 12:27 AM
Looking for a link to an artical about expect... can't seem to find it....

I'll post it if I can find it.

Sorry I could not find it.
http://linuxcommand.org/smp_e.html

Gives a good defination of it and the man pages.

from my /usr/bin/ftp.expect
---------
#!/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
------------------------

Hope it helps......

[ 07 November 2001: Message edited by: jumpedintothefire ]