Ftp via Perl cron job

B

Bill H

I have a Perl program that processes a file, saves the results in a new
file and then need to ftp that file to a different server, can anyone
point me to some documentation or a module / source on how I can
accomplish the ftp portion via Perl?

Thanks

Bill H
 
D

David Squire

Bill said:
I have a Perl program that processes a file, saves the results in a new
file and then need to ftp that file to a different server, can anyone
point me to some documentation or a module / source on how I can
accomplish the ftp portion via Perl?

How about going to search.cpan.org and searching for FTP?


DS
 
C

cartercc

Bill said:
I have a Perl program that processes a file, saves the results in a new
file and then need to ftp that file to a different server, can anyone
point me to some documentation or a module / source on how I can
accomplish the ftp portion via Perl?

#!/usr/bin/perl
use strict;
use Net::FTP;

# Step 1 - set variables to your specifications
my ($server, $username, $password, $directory, $holdfile);

# Step 2 -- FTP to server and download the holdfile
my $ftp = Net::FTP->new($server, Debug => 0) or die "Cannot connect,
$@";
$ftp->login($username, $password) or die "Cannot login ", $ftp->
message;
$ftp->cwd($dirctory) or die "Cannot change working directory ",
$ftp->message;
$ftp->ascii;
$ftp->get($holdfile) or die "Cannot get $holdfile ", $ftp->message;
$ftp->quit;

exit();


CC
 
B

Bill H

#!/usr/bin/perl
use strict;
use Net::FTP;

# Step 1 - set variables to your specifications
my ($server, $username, $password, $directory, $holdfile);

# Step 2 -- FTP to server and download the holdfile
my $ftp = Net::FTP->new($server, Debug => 0) or die "Cannot connect,
$@";
$ftp->login($username, $password) or die "Cannot login ", $ftp->
message;
$ftp->cwd($dirctory) or die "Cannot change working directory ",
$ftp->message;
$ftp->ascii;
$ftp->get($holdfile) or die "Cannot get $holdfile ", $ftp->message;
$ftp->quit;

exit();


CC

Thanks for all the information. After posting this quested I started
searching and came across the Net::FTP way of doing it. You posting the
same information makes me feel better about using it. Any idea how to
use secure ftp?

Bill H
 
J

J. Gleixner

Bill said:
Thanks for all the information. After posting this quested I started
searching and came across the Net::FTP way of doing it. You posting the
same information makes me feel better about using it. Any idea how to
use secure ftp?

Whenever you're looking for a module, always start with
CPAN ( http://search.cpan.org/ ) or at least use your
favorite Internet search engine. If you had, you'd have
found your answer without having to post and wait for
a response.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top