in reply to Re^4: renaming filenames
in thread renaming filenames

You need to post your code ( How do I post a question effectively? )

You can see my code at Re^5: rename to UTF8 filename

Replies are listed 'Best First'.
Re^6: renaming filenames
by andalou (Novice) on Aug 16, 2012 at 21:44 UTC

    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.