Home > Archive > PERL Miscellaneous > September 2006 > Ftp via Perl cron job
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 |
Ftp via Perl cron job
|
|
| Bill H 2006-09-26, 6:59 pm |
| 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
| |
| David Squire 2006-09-26, 6:59 pm |
| Bill H wrote:
> 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
| |
| Mumia W. (reading news) 2006-09-26, 6:59 pm |
| On 09/26/2006 10:44 AM, Bill H wrote:
> 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
>
You can use Net::FTP to send the file, or you can use the ftp program
from within perl by executing it using the "system" command.
--
paduille.4058.mumia.w@earthlink.net
| |
| cartercc@gmail.com 2006-09-26, 6:59 pm |
| Bill H wrote:
> 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
| |
| Bill H 2006-09-26, 6:59 pm |
|
cartercc@gmail.com wrote:
> Bill H wrote:
>
> #!/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. Gleixner 2006-09-28, 6:59 pm |
| Bill H wrote:
> 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.
|
|
|
|
|