in reply to Opening files with japanese/chinese chars in filename
What puzzles me is that you say that don't see the correct filename using explorer when you should have.This will only work if you have the asian languages (regional setings) support enabled and you should be able to see the japanase name in explorer as aboveuse Win32::OLE qw(in); use Devel::Peek; #CP_UTF8 is very important as it translates between Perl strings and U +nicode strings used by the OLE interface Win32::OLE->Option(CP => Win32::OLE::CP_UTF8); $obj = Win32::OLE->new('Scripting.FileSystemObject'); $folder = $obj->GetFolder("."); $collection= $folder->{Files}; mkdir ("c:\\newfolder")||die; foreach $value (in $collection) { $filename= %$value->{Name}; next if ($filename !~ /.txt/); Dump("$filename"); #check if the utf8 flag is on $file=$obj->GetFile("$filename"); $file->Move("c:\\newfolder\\$filename"); print (Win32::OLE->LastError() || "success\n\n"); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Opening files with japanese/chinese chars in filename
by Anonymous Monk on Apr 22, 2008 at 08:12 UTC | |
by nikosv (Deacon) on Apr 23, 2008 at 18:09 UTC |