Unix Shell - BatchFTP

This is Interesting: Free IT Magazines  
Home > Archive > Unix Shell > May 2004 > BatchFTP





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author BatchFTP
Rob Bradford

2004-05-31, 6:07 pm

All.

I am only an occasional Shellscripter,

I now have to batch FTP an unknown number of files (may be none) to
and from one machine (intel FTP server) these files will be stored in
different directoried on each day ie. /inbox/mon, /inbox/tue, and so
on.


I can batch login and do an mget by reading in keystrokes from a file,
but I would like to make the script generic so that i can gey or put
any amount of files into/from any directory on any machine using
whatever search pattern I like.

A few pointers would be useful, it would also be nice to log the files
transfered.

I will no doubt sort it out eventually, but a little help would not go
amiss.

Rob.B.
Michael Heiming

2004-05-31, 6:07 pm

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
NotDashEscaped: You need GnuPG to verify this message

In comp.unix.shell Rob Bradford <rob.bradford@lvirgin.net> suggested:
> All.


> I am only an occasional Shellscripter,


> I now have to batch FTP an unknown number of files (may be none) to
> and from one machine (intel FTP server) these files will be stored in
> different directoried on each day ie. /inbox/mon, /inbox/tue, and so
> on.


I'd use the ncftp package (ncftpput).

ncftpput(1) ncftpput(1)

NAME
ncftpput - Internet file transfer program for scripts

Good luck

--
Michael Heiming (GPG-Key ID: 0xEDD27B94)
mail: echo zvpunry@urvzvat.qr | PERL -pe 'y/a-z/n-za-m/'
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFAuYftAkPEju3Se5QRAl3BAJ9HUJ2NIud6
4MasC1meIK5eivwnuQCfUz8v
zHz8TXLMuc3NOCkNcbXHf5M=
=UA+K
-----END PGP SIGNATURE-----
Peter J. Acklam

2004-05-31, 6:07 pm

Rob Bradford <rob.bradford@lvirgin.net> wrote:

> I now have to batch FTP an unknown number of files (may be none)
> to and from one machine (intel FTP server) these files will be
> stored in different directoried on each day ie. /inbox/mon,
> /inbox/tue, and so on.
>
> I can batch login and do an mget by reading in keystrokes from a
> file, but I would like to make the script generic so that i can
> gey or put any amount of files into/from any directory on any
> machine using whatever search pattern I like.


Create a ~/.netrc file with the machine name, user name, and
password, and set the permissions to 0400. Then write your
commands to ftp's stdin

ftp HOST <<EOF
cd DIR
put FILE
...
EOF

or, if you need to do more processing and feed it to ftp as you go
along,

(
# do lots of stuff here which writes to stdout
) | ftp

Peter

--
Peter J. Acklam - pjacklam@online.no - http://home.online.no/~pjacklam
those who know me have no need of my name

2004-05-31, 6:07 pm

in comp.unix.shell i read:

>I am only an occasional Shellscripter,
>
>I now have to batch FTP an unknown number of files (may be none) to
>and from one machine (intel FTP server) these files will be stored in
>different directoried on each day ie. /inbox/mon, /inbox/tue, and so
>on.


i suggest a good ftp client, e.g., kermit or ncftp.

--
a signature
Christopher Browne

2004-05-31, 11:50 pm

Martha Stewart called it a Good Thing when Rob Bradford <rob.bradford@lvirgin.net> wrote:
> I am only an occasional Shellscripter,
>
> I now have to batch FTP an unknown number of files (may be none) to
> and from one machine (intel FTP server) these files will be stored in
> different directoried on each day ie. /inbox/mon, /inbox/tue, and so
> on.
>
>
> I can batch login and do an mget by reading in keystrokes from a file,
> but I would like to make the script generic so that i can gey or put
> any amount of files into/from any directory on any machine using
> whatever search pattern I like.
>
> A few pointers would be useful, it would also be nice to log the files
> transfered.
>
> I will no doubt sort it out eventually, but a little help would not go
> amiss.


If you want to "push" files out, it would be well worthwhile to look
into "ncftpput" and "ncftpbatch".

If you need to "pull" files, a common tool for the purpose is wget.
--
output = reverse("gro.gultn" "@" "enworbbc")
http://www.ntlug.org/~cbbrowne/linuxxian.html
"If use of the GPL filters out people who are only interested in
inventing the worst possible motives for my actions then, yes, I'm
happy to learn that it serves a useful purpose I'd never thought of."
-- Dave Pearson
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com