I have a script that uploads a series of files from one server to another using Net::FTP. The problem is that many times these files already exist and when they do, the server kicks back a "Do you want to overwrite" option. I am trying to run this automatically, but needless to say these overwrite options stop the rest of the program. My question is: Is there a way to set the options for overwrite inside of the script? Here is a sample of my code!
Any help would be greatly appreciated!
Code:
$ftp = Net::FTP->new("hostname", Debug => 0) or die "Cannot connect: $@";
$ftp->login("login",'password') or die "Cannot login ", $ftp->message;
$ftp->cwd("public_html/images/full/") or die "Cannot change working directory to full:", $ftp->message;
print "connected getting ready to upload fullsize . . . . ";
opendir(DIR, "$dirname") or die "can't opendir $dirname: $!";
while (defined($file = readdir(DIR))) {
if($file eq ".") {
next;
}
if($file eq "..") {
next;
}
$ftp->put("full/$file") or die "put failed ", $ftp->message;
$fulls_uploaded++;
}
Any help would be greatly appreciated!