in reply to Re: rename to UTF8 filename
in thread rename to UTF8 filename
There are 2 sample files in folder 2.4.use Win32API::File 0.08 qw( :ALL ); #use Win32::Unicode::File; binmode STDOUT, ":utf8"; open F, "Result_fineName.txt"; #binmode F, ":utf8"; # binmode or not still won't work my @list = <F>; close F; chomp @list; my %hash; foreach (@list) { my ( $id, $name ) = split /\t/, $_, 2; $name =~ s/[\\\/\<\>\?\:\|\*]/ /g; $name =~ s/ {2,}/ /g; $hash{$id} = $name; } chdir ( "./doRename/2.4" ) ; my $source = `dir /b`; my @src = split /\n/, $source; chomp @src; foreach my $f ( @src ) { my @parts = split /[ _]/, $f; print $f ; MoveFile $f, "$hash{$parts[1]}.mp3" or print fileLastError() ; #W +in32API::File #moveW $f, "$hash{$parts[1]}.mp3" or print errorW; # Win32::Un +icode::File print $/; }
The other will rename to a pure Japanese file name.
If I use the Win32API::File way, it rasied an err : The filename, directory name, or volume label syntax is incorrect
If use the Win32::Unicode::File way, it does nothing, no err, and no rename.
Note, before I run this from my cmd prompt, I've changed codepage to 65001. Without this, the error message will raise in Chinese ( I guess ), as it showed in monster as well.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: rename to UTF8 filename
by Anonymous Monk on Jul 30, 2012 at 07:56 UTC | |
by exilepanda (Friar) on Jul 30, 2012 at 08:37 UTC | |
by Anonymous Monk on Jul 30, 2012 at 09:36 UTC | |
by exilepanda (Friar) on Jul 31, 2012 at 04:06 UTC | |
by Anonymous Monk on Aug 13, 2012 at 10:53 UTC | |
by Anonymous Monk on Jul 30, 2012 at 08:40 UTC |