in reply to Net::FTP::Recursive Permission and Ownership...
Ex: Untested!
#!/usr/bin/perl -w use strict; use Net::FTP; my $ftp_login = "login"; my $ftp_pass = "password"; my $file = "/full/file/path/to/code.tar"; my $chmod = "chmod 777 $file"; my $chown = "chown user $file"; my @list = qw[server1 server2 server3 server4 server5]; for (@list) { if (my $ftp = Net::FTP->new($_)) { print "FTP object is: $ftp\n"; print "\nFTP session for $_ is active!\n"; print "Logging in ..."; if ($ftp->login($ftp_login,$ftp_pass)) { print "Done!\n\n"; $ftp->binary(); $ftp->put($file); $ftp->cmd($chmod); $ftp->cmd($chown); print "Upload complete and permissions set!\n"; }else{ print "\nCould not log in!\n"; $ftp->quit(); } }else{ print "A connection to $_ was not made!\n"; } }
|
|---|