What platform are you using this on? I am going to assume Linux? As far as the permissions go these settings are probably the default settings for new files and directories for the systems themselves. You can change the default settings to match what you want each new file and directory to reflect or simply change the permissions upon upload completion.
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";
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.