Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Feb 1998 10:47:10 +0100 (MET)
From:      Ugo Paternostro <paterno@dsi.UNIFI.IT>
To:        George Vagner <kf7nn@mutsgo.dyn.ml.org>
Cc:        questions@FreeBSD.ORG
Subject:   RE: auto ftp upload
Message-ID:  <XFMail.980221104710.paterno@dsi.unifi.it>
In-Reply-To: <199802191501.JAA29137@mutsgo.dyn.ml.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 19-Feb-98 George Vagner wrote about "auto ftp upload":
> i want to automatically upload a file using ftp to a web site
> without user intervention but i dont know the syntax to pass the file to the
> ftp program.

The ftp program that comes with the OS is an interactive tool: it is meant to
be used typing commands "online". This does *NOT* mean that you have to use it
that way ;-)

You can, for example, grab your favorite text editor and create a file like
this:

----------------CUT----------------
open some.site.in.the.net
user your.user.name your.password
bin
cd some/where/it/the/host/tree
put something.tar.gz
close
quit
----------------CUT----------------

Let's call this file "ftp.cmd". Then you may issue the following command:

    ftp -inv <ftp.cmd

and the ftp program will gladly execute all the command you put in the ftp.cmd
file.

Possible variations of this technique include the use of nohup, the output
redirection, the use of "tail -f" and the use of pipes to execute dynamic
scripts. All these variations are left as an exercise to the reader ;-)

Of course you could apply this technique also to download files, but in that
case you may want to use fetch or the ftp program in one of the "new" usage
formats, as reported in the ftp man page.

I hope this helps.

Bye, UP


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.980221104710.paterno>