starface245 has asked for the wisdom of the Perl Monks concerning the following question:
It is not renaming the file to the path file nameuse File::Find; use File::Basename; use File::Spec; use strict; find ({ 'wanted' => \&renamefile }, 'c:\\folder1\\folder2'); sub renamefile { my $file = $_; return unless (-f $file); my $dirname = dirname($file); my $file_name = basename($file); my $new_file_name = $file_name; $new_file_name =~ s/\\\\/./g; rename($file,File::Spec->catfile($dirname,$new_file_name))or die; }
|
|---|