#!/usr/bin/perl -w use strict; use Net::FTP; use FileHandle; ### # A Script that will get files from one server object # stored in $ftp_a and put them onto a second server # object, $ftp_b. # # Objective is to do this using filehandles, and not # actually writing to disk. ### ### # File list. Generate however you want. ### my @file_list = ("some.file"); ### # Begin by opening the connections to the two servers # and logging in. ### my $ftp_a = Net::FTP->new("first.server.address", Debug => 0); my $ftp_b = Net::FTP->new("second.server.address", Debug=> 0); $ftp_a->login("first_server_username","first_server_password"); $ftp_b->login("second_server_username","second_server_password"); my $fh = FileHandle::new; foreach (@file_list) { $ftp_a->get($_,$fh); $ftp_b->put($fh,$_); unlink($fh); } $ftp_a->quit; $ftp_b->quit;