kicap has asked for the wisdom of the Perl Monks concerning the following question:

I am very2 new in PERL..I have one question for u guys..I have a folder needs to transfered from my machine to the other machine..This folder have some file inside..I have created one script in PERL by using Net::FTP modules, but this script only allow me transfer a single file...Here is the script..
> $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->me +ssage; > $ftp->binary(); > > $ftp->put($input_file, $new_file_name) or warn "...Not upload..";
Did anyone have any idea about this?....Thanks a lot...

Replies are listed 'Best First'.
Re: Transfer folder using Net::FTP
by pg (Canon) on Oct 15, 2004 at 03:10 UTC

    use File::Glob to get a list of files, and then loop thru them.

    use Data::Dumper; use File::Glob ':glob'; use strict; use warnings; my @files = bsd_glob("*.pl"); foreach my $file (@files) { print $file, "\n"; }

    In case you know ant, it is easy to use ant. It supports a ftp task.

Re: Transfer folder using Net::FTP
by kicap (Novice) on Oct 15, 2004 at 02:45 UTC
    ...