Click to See Complete Forum and Search --> : auto-ftp with bash ?


[Mystik_Cool]
01-05-2002, 09:32 AM
I'm sure I could find the answer somewhere on the net (maybe even simply on this forum), but I don't have the time (In fact, I mean... I'm with a very expensive connection for a few days and... most of all, I don't have the money :rolleyes: ).
So excuse me, and please answer ! :)

My question is :

How could I write a small bash script which would connect me with login/password to a FTP server, verify if I'm logged in, send a file and then logout ?
Please make it simple if you can, I don't know anything about bash scripting... I'm learning, but I don't have the time for the moment (work, always work...)

Thx a lot to the one who will help me ! :)

Strike
01-05-2002, 10:51 AM
An easy programming language for doing this is Expect (http://expect.nist.gov/).

demian
01-05-2002, 10:56 AM
There's a program called ftp-upload which does just that. The downside is that you will have to store the unencrypted password in the script to make it work autonomous. I don't know if the program has a homepage but if you do a google linux search you will find places to download it.

[Mystik_Cool]
01-05-2002, 11:08 AM
Thanx a lot for this help ! :)

I'm going to read all the readme's provided with it, but Expect doesn't look really simple (at first contact), I think I would spend less time learning bash than how to use expect correctly ;)

So, if someone has it, the bash code still interests me very much...

[ 05 January 2002: Message edited by: [Mystik_Cool] ]

EscapeCharacter
01-05-2002, 11:37 AM
you might want to use autoexpect if you are really lazy, you just do something like autoexpect ftp ftp.somehost.com then when ftp exits a script will be created with the complete transaction, no need to code anything

[Mystik_Cool]
01-05-2002, 12:13 PM
Not laziness, lack of time.

Be sure I'll give great interest to Expect when I'll have the time. (Maybe when I'll be retired... or dead...)

PS: that's not the right forum for answering that but, is it normal that I can't change my profile anymore since a few months ? Do I have to disturb the webmaster for that ?

EscapeCharacter
01-05-2002, 02:03 PM
Originally posted by [Mystik_Cool]:
<STRONG> Do I have to disturb the webmaster for that ?</STRONG>

lno has a webmaster? :P

demian
01-05-2002, 03:40 PM
Originally posted by [Mystik_Cool]:
<STRONG>So, if someone has it, the bash code still interests me very much...</STRONG>
Well, I wouldn't really call this code but uploading a file called foo.bar to ftp.foobar.foo with ftp-upload works like this:

ftp-upload -v -h ftp.foobar.foo --password &lt;password&gt; -u &lt;username&gt; --dir &lt;optional: dest dir&gt; /path/to/foo.bar

...what could be easier?

[Mystik_Cool]
01-05-2002, 03:55 PM
Great ! Thx very much, so simple, and it works fine ! :)

[ 05 January 2002: Message edited by: [Mystik_Cool] ]