1757825 Members
2782 Online
108865 Solutions
New Discussion юеВ

ftp question

 
SOLVED
Go to solution
linda_9
Occasional Advisor

ftp question

Hi,
who can tell me how to let a ftp shell automatically excute?
linda
6 REPLIES 6
Michael Tully
Honored Contributor
Solution

Re: ftp question

Hi,

Have a look at these posting:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x83e45f260cafd4118fef0090279cd0f9,00.html

There is also some interesting information that can be found in the 'netrc' man pages.

Cheers
~Michael

Anyone for a Mutiny ?
linda_9
Occasional Advisor

Re: ftp question

my problem is how to write the shell .
linda
S.K. Chan
Honored Contributor

Re: ftp question

Example of a script ..

#!/bin/ksh

[[ $# != 5 ]] &&
{ echo "Usage: $0 ";exit 1; }

{ echo "user $1 $2
cd $5
mput $4
quit" ; } | ftp -i -n $3

You would run it as such ..(say you call your script "autoput".

# ./autoput skchan mypassword mars.abc.com fileA* dirA
Michael Tully
Honored Contributor

Re: ftp question

Hi,

There are many exmaples of this, here are some to do with scripting. If these aren't enough suggest using the search bar to the left <-- and lookf for 'ftp scripts'. You will find that there are many.

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xfbc0854994d9d4118fef0090279cd0f9,00.html
http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x82dff841489fd4118fef0090279cd0f9,00.html
Anyone for a Mutiny ?
Gnananandhan
Frequent Advisor

Re: ftp question


You can use ftp -i -n < file.

"file" will contain:

open
user
commands
commands
bye

If there is a better way to do it, find it !
Deinert Arthur
New Member

Re: ftp question

I use a here-script:


ftp -i -n <<@
open $hostname
user $login $passw
lcd $targetdir
cd $sourcedir
mget *
close
quit
@