Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/bin/perl -w
- # rename the gbk filename to utf-8
- use strict;
- use Encode;
- my $dir = $ENV{'PWD'};
- opendir DIR, $dir or die "Can not open \"$dir\"\n";
- my @filelist = readdir DIR;
- my $file = '';
- for $file (@filelist)
- {
- chomp $file;
- if ($file ne '.' && $file ne '..')
- {
- my $utf8str = encode("utf-8", decode("gbk",$file));
- chomp $utf8str;
- `mv "$file" "$utf8str"`;
- }
- }
- closedir DIR;
- @filelist = ();
- opendir DIR, $dir or die "Can not open \"$dir\"\n";
- @filelist = readdir DIR;
- for $file (@filelist)
- {
- print "$file\n";
- }
- closedir DIR;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement