From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,5dfb3d4763167977 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-02-05 02:08:23 PST Path: supernews.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!ihug.co.nz!news-hog.berkeley.edu!ucberkeley!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!pa.dec.com!usenet From: "Aneesh Kumar K.V" Newsgroups: comp.unix.tru64 Subject: Re: FTP Scripting Date: Mon, 05 Feb 2001 15:47:12 +0530 Organization: Digital India Message-ID: <3A7E7DA7.214543F5@digital.com> References: <95e39j$kgo$1@nnrp1.deja.com> <3A7B3DFB.C19EF5B6@us.ibm.com> NNTP-Posting-Host: 16.168.64.37 Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="------------E9082DB444E382F55827CAFD" X-Mailer: Mozilla 4.61 [en] (X11; I; Linux 2.4.0 i686) X-Accept-Language: en Xref: supernews.google.com comp.unix.tru64:1644 --------------E9082DB444E382F55827CAFD Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 > > "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 --------------E9082DB444E382F55827CAFD Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit 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


  --------------E9082DB444E382F55827CAFD-- From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,5dfb3d4763167977,start X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-02-02 03:00:08 PST Path: supernews.google.com!sn-xit-02!supernews.com!news.gv.tsc.tdk.com!news.iac.net!news-out.cwix.com!newsfeed.cwix.com!news.maxwell.syr.edu!nntp2.deja.com!nnrp1.deja.com!not-for-mail From: freedave73@hotmail.com Newsgroups: comp.unix.tru64 Subject: FTP Scripting Date: Fri, 02 Feb 2001 10:48:20 GMT Organization: Deja.com Message-ID: <95e39j$kgo$1@nnrp1.deja.com> NNTP-Posting-Host: 195.50.90.132 X-Article-Creation-Date: Fri Feb 02 10:48:20 2001 GMT X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt) X-Http-Proxy: 1.0 SBJEXCHANGE01, 1.0 LDNIPS01, 1.0 x69.deja.com:80 (Squid/1.1.22) for client 195.50.90.132 X-MyDeja-Info: XMYDJUIDfreedave73 Xref: supernews.google.com comp.unix.tru64:1619 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/ From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fa528,5dfb3d4763167977 X-Google-Attributes: gidfa528,public X-Google-ArrivalTime: 2001-02-02 06:04:08 PST Mime-Version: 1.0 X-Newsreader: knews 1.0b.0 References: <95e39j$kgo$1@nnrp1.deja.com> From: schweng@astro.unibas.ch (Hans Schwengeler) Subject: Re: FTP Scripting Newsgroups: comp.unix.tru64 Content-Type: text/plain; charset=us-ascii NNTP-Posting-Host: saturn.astro.unibas.ch Message-ID: <3a7abe53$1@maser.urz.unibas.ch> Date: 2 Feb 2001 15:04:03 +0100 X-Trace: 2 Feb 2001 15:04:03 +0100, saturn.astro.unibas.ch Path: supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!194.42.224.136!diablo.netcom.net.uk!netcom.net.uk!news-hub.cableinet.net!Quza.UK.peer!nntp.gblx.net!merapi!news-zh.switch.ch!maser.urz.unibas.ch!saturn.astro.unibas.ch Xref: supernews.google.com comp.unix.tru64:1622 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 < Newsgroups: comp.unix.tru64 Subject: Re: FTP Scripting Date: Fri, 02 Feb 2001 17:08:43 -0600 Organization: IBM Rochester MN Message-ID: <3A7B3DFB.C19EF5B6@us.ibm.com> References: <95e39j$kgo$1@nnrp1.deja.com> Reply-To: griswold@acm.org NNTP-Posting-Host: unknown.rchland.ibm.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: news.rchland.ibm.com 981155324 37710 9.5.30.17 (2 Feb 2001 23:08:44 GMT) X-Complaints-To: usenet@news.rchland.ibm.com NNTP-Posting-Date: 2 Feb 2001 23:08:44 GMT X-Mailer: Mozilla 4.75 [en] (X11; U; Linux 2.2.12 i686) X-Accept-Language: en Xref: supernews.google.com comp.unix.tru64:1632 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 "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."