in reply to Re: Rename Windows files with Unicode chars
in thread Rename Windows files with Unicode chars

Another option is with the COM interface,more here:
Unicode issues in Perl (from a windows perspective)
www.i-programmer.info/programming/other-languages/1973-unicode-issues-in-perl.html
  • Comment on Re^2: Rename Windows files with Unicode chars

Replies are listed 'Best First'.
Re^3: Rename Windows files with Unicode chars
by nikosv (Deacon) on Sep 02, 2016 at 04:32 UTC
    thanks for the mention. The article goes to lengths in describing the underlying encoding issues and how to deal with them,but for the OP's purpose the following code snippet extracted from the article should do it
    use Win32::Console; Win32::Console::OutputCP( 65001 ); use Devel::Peek; use Win32::OLE qw(in); binmode(STDOUT, ":utf8"); Win32::OLE->Option(CP => Win32::OLE::CP_UTF8); $obj = Win32::OLE-> new('Scripting.FileSystemObject'); $folder = $obj->GetFolder("."); $collection= $folder->{Files}; foreach $value (in $collection) { $filename= %$value->{Name}; next if ($filename !~ /.rar/i); print $filename,"\n"; Dump $filename,"\n"; }
    I haven't benchmarked it but logically the Win32 API calls should be faster than calling into the COM,but nevertheless COM exposes FileSystemObjects methods which might be convenient anyway