TheNewbie81
Technical User
Hi,
I am trying to rename files ona remote server using this simple bit of code, but it doesnt work, can anyone point out what im doing wrong?
cheers
Jon
I am trying to rename files ona remote server using this simple bit of code, but it doesnt work, can anyone point out what im doing wrong?
cheers
Jon
Code:
#!/usr/bin/perl
use Net::FTP;
$ftp = Net::FTP->new("localhost", Debug => 0);
$ftp->login("anonymous",'-anonymous@');
$ftp->cwd("/");
@dir=$ftp->ls or $newerr=1;
foreach $file(@dir){
$ftp->get($file);
$ftp->rename( $file, "$file\.recieved")
or die "Couldn't rename file";
}
$ftp->quit;