Skip to content

Instantly share code, notes, and snippets.

@aero
Created July 25, 2011 07:44
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save aero/1103723 to your computer and use it in GitHub Desktop.
Save aero/1103723 to your computer and use it in GitHub Desktop.
Rename MacOS X NFD hangule to NFC
#!/usr/bin/env perl
# 사용법
# perl demacboogi.pl *.zip #zip파일만 변환
# perl demacboogi.pl #모든파일 변환
use 5.010;
use strict;
use warnings;
use Encode qw/encode decode/;
use Unicode::Normalize qw/compose/;
use File::Copy;
my @files = @ARGV;
@files = glob('*') if @files == 0;
foreach my $file (@files) {
my $from = decode('utf8', $file);
my $to = compose($from);
if ($from ne $to) {
say encode('utf8', "move $from -> $to");
move($from, $to);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment