* FTP Scripting
@ 2001-02-02 10:48 freedave73
2001-02-02 14:04 ` Hans Schwengeler
2001-02-02 23:08 ` RL Griswold
0 siblings, 2 replies; 4+ messages in thread
From: freedave73 @ 2001-02-02 10:48 UTC (permalink / raw)
Can anyone please help. I am having difficulty in creating a script to
run a series of mput statements on a remote server via FTP.
Is it possible to script FTP in Digital UNIX 4.0D or E and if so, how
do I do it?
If anyone can help I would be very grateful.
Cheers
Dave
Sent via Deja.com
http://www.deja.com/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FTP Scripting
2001-02-02 10:48 FTP Scripting freedave73
@ 2001-02-02 14:04 ` Hans Schwengeler
2001-02-02 23:08 ` RL Griswold
1 sibling, 0 replies; 4+ messages in thread
From: Hans Schwengeler @ 2001-02-02 14:04 UTC (permalink / raw)
In article <95e39j$kgo$1@nnrp1.deja.com>,
freedave73@hotmail.com writes:
> Can anyone please help. I am having difficulty in creating a script to
> run a series of mput statements on a remote server via FTP.
>
> Is it possible to script FTP in Digital UNIX 4.0D or E and if so, how
> do I do it?
>
> If anyone can help I would be very grateful.
>
> Cheers
> Dave
>
>
> Sent via Deja.com
> http://www.deja.com/
Dear Dave,
well, in those old times I used the following:
#!/usr/bin/sh
ftp -n ftphost.somewhere.com <<EXIT
user anonymous user@myhost.here.edu
cd pub
cd software
binary
get test.tar.gz
quit
EXIT
Hope this helps.
Yours, Hans.
--
===============================================================================
Hans Schwengeler
Astronomical Institute INTERNET: schweng@astro.unibas.ch
University of Basel Hans.Schwengeler@unibas.ch
Venusstrasse 7
CH-4102 Binningen PHONE: +41 61 20 55 422
Switzerland FAX: +41 61 20 55 455
===============================================================================
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FTP Scripting
2001-02-02 10:48 FTP Scripting freedave73
2001-02-02 14:04 ` Hans Schwengeler
@ 2001-02-02 23:08 ` RL Griswold
2001-02-05 10:17 ` Aneesh Kumar K.V
1 sibling, 1 reply; 4+ messages in thread
From: RL Griswold @ 2001-02-02 23:08 UTC (permalink / raw)
freedave73@hotmail.com wrote:
>
> Can anyone please help. I am having difficulty in creating a script to
> run a series of mput statements on a remote server via FTP.
>
> Is it possible to script FTP in Digital UNIX 4.0D or E and if so, how
> do I do it?
>
> If anyone can help I would be very grateful.
>
> Cheers
> Dave
>
> Sent via Deja.com
> http://www.deja.com/
I usually use Perl's Net::FTP module. Here's a simple script that puts
up a single file:
--
#!/usr/bin/perl
use strict;
use Net::FTP;
my ( $execname, $usage, $ftp, $host, $user, $type, $local, $remote );
$execname = $0;
$execname =~ s/^.+\///;
$usage = "Usage: $execname host user local remote
host System to FTP file to
user User ID for FTP
type 'A'SCII or 'B'inary
local Local file name
remote Remote file name (optional, defaults to local name)
";
if ( $#ARGV == 3 ) {
$host = shift @ARGV; $user = shift @ARGV;
$type = shift @ARGV; $local = shift @ARGV;
} elsif ( $#ARGV == 4 ) {
$host = shift @ARGV; $user = shift @ARGV; $type = shift @ARGV;
$local = shift @ARGV; $remote = shift @ARGV;
} else { die $usage; }
if ( ( $type ne 'A' ) and ( $type ne 'B' ) ) { die $usage; }
if ( not ( $ftp = Net::FTP->new( $host ) ) ) {
die "FTP to $host failed\n";
}
if ( not $ftp->login( $user ) ) {
die "FTP to $host as $user failed\n";
}
if ( $type eq 'A' ) { $ftp->ascii(); } else { $ftp->binary(); }
if ( $remote ) { $remote = $ftp->put( $local, $remote ); }
else { $remote = $ftp->put( $local ); }
if ( not $remote ) { die "Put of $local failed\n"; }
print "Put $local on $host as $remote\n";
$ftp->quit();
--
Richard Griswold - griswold@acm.org
#include <stddisclaimer.h>
"But I don't want to go among mad people," Alice remarked.
"Oh, you ca'n't help that," said the Cat:
"We're all mad here. I'm mad. You're mad."
"How do you know I'm mad?" said Alice.
"You must be," said the Cat, "or you wouldn't have come here."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: FTP Scripting
2001-02-02 23:08 ` RL Griswold
@ 2001-02-05 10:17 ` Aneesh Kumar K.V
0 siblings, 0 replies; 4+ messages in thread
From: Aneesh Kumar K.V @ 2001-02-05 10:17 UTC (permalink / raw)
[-- Attachment #1: Type: text/plain, Size: 2418 bytes --]
You can use lftp binary . If you don't have i can mail it you . It is a
straight forward compilation .
-aneesh
RL Griswold wrote:
> freedave73@hotmail.com wrote:
> >
> > Can anyone please help. I am having difficulty in creating a script to
> > run a series of mput statements on a remote server via FTP.
> >
> > Is it possible to script FTP in Digital UNIX 4.0D or E and if so, how
> > do I do it?
> >
> > If anyone can help I would be very grateful.
> >
> > Cheers
> > Dave
> >
> > Sent via Deja.com
> > http://www.deja.com/
>
> I usually use Perl's Net::FTP module. Here's a simple script that puts
> up a single file:
>
> --
> #!/usr/bin/perl
> use strict;
> use Net::FTP;
> my ( $execname, $usage, $ftp, $host, $user, $type, $local, $remote );
> $execname = $0;
> $execname =~ s/^.+\///;
> $usage = "Usage: $execname host user local remote
> host System to FTP file to
> user User ID for FTP
> type 'A'SCII or 'B'inary
> local Local file name
> remote Remote file name (optional, defaults to local name)
> ";
>
> if ( $#ARGV == 3 ) {
> $host = shift @ARGV; $user = shift @ARGV;
> $type = shift @ARGV; $local = shift @ARGV;
> } elsif ( $#ARGV == 4 ) {
> $host = shift @ARGV; $user = shift @ARGV; $type = shift @ARGV;
> $local = shift @ARGV; $remote = shift @ARGV;
> } else { die $usage; }
> if ( ( $type ne 'A' ) and ( $type ne 'B' ) ) { die $usage; }
> if ( not ( $ftp = Net::FTP->new( $host ) ) ) {
> die "FTP to $host failed\n";
> }
> if ( not $ftp->login( $user ) ) {
> die "FTP to $host as $user failed\n";
> }
> if ( $type eq 'A' ) { $ftp->ascii(); } else { $ftp->binary(); }
> if ( $remote ) { $remote = $ftp->put( $local, $remote ); }
> else { $remote = $ftp->put( $local ); }
> if ( not $remote ) { die "Put of $local failed\n"; }
> print "Put $local on $host as $remote\n";
> $ftp->quit();
> --
>
> Richard Griswold - griswold@acm.org
> #include <stddisclaimer.h>
>
> "But I don't want to go among mad people," Alice remarked.
> "Oh, you ca'n't help that," said the Cat:
> "We're all mad here. I'm mad. You're mad."
> "How do you know I'm mad?" said Alice.
> "You must be," said the Cat, "or you wouldn't have come here."
--
"I suspect it won't be long before parents start hearing
'Mom, Dad, please can I have the administrator password
to
my t-shirt?! I promise not to put anything bad on
it!!'"
-Jeff
[-- Attachment #2: Type: text/html, Size: 3147 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2001-02-05 10:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-02 10:48 FTP Scripting freedave73
2001-02-02 14:04 ` Hans Schwengeler
2001-02-02 23:08 ` RL Griswold
2001-02-05 10:17 ` Aneesh Kumar K.V
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox