> I have develop a perl script that transfer a data that we want, from one machine to another machine..... > > $ftp_server = "***.***.***.***"; > $login = "roime"; > $password = "roimepuniran"; > $upload_to_dir = "/flow/flowBig"; > $input_file = "/flow/netflow"; > $new_file_name = "lyidia.pl"; > > ================================================================= > > my $ftp; > print "Connect From : ", $addr->peerhost(); > #Display Message > > $ftp = Net::FTP->new($ftp_server, Debug => 1) or warn "Cannot connect to the ftp host"; > > $ftp->login($login,$password)or die $ftp->message; > $ftp->pwd or die $ftp->message; > $ftp->cwd($upload_to_dir) or die $ftp->message; > $ftp->binary(); > > $ftp->put($input_file, $new_file_name) or warn "...Not upload.."; > > > ...And it's success...And now, i am trying to transfer a folder(contains some data) using FTP in same method...Until now i had nothing reach..So, can anyone give me some idea how can i transfer a folder from one machine to another machine using FTP in PERL ?....Where can i got some great resources?... > > Thanks...
There are a number of programs/scripts already written to do this, but in the case you still want to grow it at home, Net::FTP provides a C<dir> method for retrieving a list of files in a directory. You can loop over that list doing a GET on each to copy the contents of the directory. If you want to do it recursively you would need to use the C<ls> (I think) method, check the first character of each return value to see if it is a directory, C<cwd> to that directory and repeat the process. http://danconia.org -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>