[comp.protocols.tcp-ip] One-shot ftp client

mkirk@zaphod.axion.bt.co.uk (Martin Kirk) (02/18/90)

Does anyone have a one-shot ftp client that takes all its arguments,
(host, username, password, filename, etc), from the command line?

I have seen several references to the existence of such a program and
now have a need for one. True to tradition I would like to avaoid
writing it if at all possible.

Thanks in advance,

Martin Kirk


============================================================================
E-Mail:       MKirk@axion.bt.co.uk (...mcvax!ukc!axion!mkirk)
Organisation: British Telecom Research Laboratories (RT3134)
Snail Mail:   BTRL, Rm 306A SSTF, Martlesham Heath, IPSWICH IP5 7RE, UK
Telephone:    +44 473 642518            Fax: +44 473 643019
Quote:        "It has been stated somewhere that men can be divided into
	       two classes - those who can and those who can not stop a dog
	       fight."          "Bulldog Drummond at Bay" by "Sapper"
============================================================================

rcs89301@zach.fit.edu ( Thomas E. Currey) (02/20/90)

Off the top of my head: you might try this
It accepts the arguements you wanted

usage :  shftp address loginname password [file1 file2 file3 file4 file5 file6]


-----------------------CUT HERE Beware no comments read manual--------------
#! /bin/sh
cat "machine $1 login $2 password $3" >> $HOME/.netrc
chmod 600 $HOME/.netrc
echo "binary
get $4 
get $5 
get $6 
get $7 
get $8 
get $9 
quit" > $HOME/ftp.tmp
ftp $1 < $HOME/ftp.tmp > /dev/null       
rm $HOME/ftp.tmp
--------------------------------------------------------------------------

There is also a nifty program on simtel20. It dos the same thing
but with a timer. "auto-ftp"

news@sq.sq.com (02/27/90)

In article <792@winnie.fit.edu>, rcs89301@zach.fit.edu ( Thomas E.
Currey) writes:
> 
> usage :  shftp address loginname password [file1 file2 file3 file4
file5 file6]
> 
> -----------------------CUT HERE Beware no comments read manual--------------
> #! /bin/sh
> cat "machine $1 login $2 password $3" >> $HOME/.netrc
> chmod 600 $HOME/.netrc
> echo "binary
> get $4 
> get $5 
> get $6 
> get $7 
> get $8 
> get $9 
> quit" > $HOME/ftp.tmp
> ftp $1 < $HOME/ftp.tmp > /dev/null       
> rm $HOME/ftp.tmp
> --------------------------------------------------------------------------

Here is a version that has a greater chance of working (it echoes the
arguments into ~/.netrc, instead of trying to cat a non-existant file onto
it :-( ), and that makes the computer do the gruntwork like making the temp
file and remembering what args go where.

#! /bin/sh
# yet another batch ftp client
# usage: shftp address loginname password file1 [file2 file3 file4 file5 file6]

machine=$1
login=$2
passwd=$3
shift; shift; shift;
echo "machine $machine login $login password $passwd" >> $HOME/.netrc
chmod 600 $HOME/.netrc

ftp $machine <<!
binary
get $1
get $2
get $3
get $4
get $5
get $6
quit
!
sort -u -o $HOME/.netrc $HOME/.netrc & # now filter out dups, in background


Ian Darwin
ian@sq.com

carl@csli.Stanford.EDU (Carl Schaefer) (02/28/90)

In article <1990Feb26.200045.24761@sq.sq.com> ian@SQ.Com (ian) writes:
] #! /bin/sh
] # yet another batch ftp client
] # usage: shftp address loginname password file1 [file2 file3 file4 file5]
] 
] machine=$1
] login=$2
] passwd=$3
] shift; shift; shift;
] echo "machine $machine login $login password $passwd" >> $HOME/.netrc
] chmod 600 $HOME/.netrc
] 
] ftp $machine <<!
] binary
] get $1
] get $2
] get $3
] get $4
] get $5
] get $6
] quit
] !
] sort -u -o $HOME/.netrc $HOME/.netrc & # now filter out dups, in background
] 
] 
] Ian Darwin
] ian@sq.com


urk.  how crufty.  How about:

    #!/bin/sh
    # usage: shftp address loginname password file

    ftp -n << +
      open $1
      quote USER $2
      quote PASS $3
      get $4
    +
    exit
-- 
Carl Schaefer
carl@csli.stanford.edu