in reply to Re^5: renaming filenames
in thread renaming filenames
I've already posted my code at the beginning of this thread:
#!perl use utf8; my $directory = '.'; opendir (MYHANDLE , $directory) || die "Cant open directory :$!\n"; my @files = readdir MYHANDLE; closedir MYHANDLE; foreach (@files) { my $original = $_; s/canción/poesía/; rename "$directory\\$original", "$directory\\$_"; }
And GrandFather proposed this code:
use strict; use warnings; use utf8; use Win32::API; my $moveFile = Win32::API->new("Kernel32", MoveFileW => 'PP', "I"); my $to = 'poesía'; my $from = 'canción'; $moveFile->Call(Encode::encode("UTF-16LE", $from), Encode::encode("UTF-16LE", $to));
which doesn't work for the reasons explained in my previous message.
|
|---|