Hi all,
I want to rename all image files in a folder to a new name, only the
number should be kept:
use strict;
use warnings;
use 5.014;
foreach my $file (glob "*.tif") {
$file =~ m/(\d\d?).tif/;
rename($file, "DAT:26032013--WEL:A2--ID:"."$1") || die("Could not
rename file: $!\n");
}
I always get "permission denied". Strange enough, while writing the
script I already tried renaming all the files to the same name so that
at the end there would be just one file (for test purposes) and that
worked. When I tried again with the pattern above I got the permission
error. I read that sometimes open files cause problems but I already
restarted the PC, turned off antivirus and backup and now I'm running
the console as an administrator and still get the error. Plus, I read
that closedir sometimes helps but there's not even a directory open
here, or is there in the background?
Any suggestions on this?
Many thanks.
Florian
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/