File path is missing from parameters. Try:
my $dir = "kennel"; opendir(DIR,$dir) or die "Cannot read $dir\n"; while ($file = readdir(DIR)) { next unless $file =~ /cat/; my $newfile = $file; $newfile =~ s/cat/dog/; rename("$dir/$file", "$dir/$newfile") || print "Don't have permiss +ion to rename.\n"; } closedir(DIR);
In reply to Re: rename doesn't work on OSX?
by vitoco
in thread rename doesn't work on OSX?
by mmfuller
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |