Last active
October 8, 2019 05:58
-
-
Save joonahn/430e2b2fa558603f678137dc2b6f80d1 to your computer and use it in GitHub Desktop.
mac에서 생성한 한글 파일명을 windows에서 읽을 때 깨진 파일을 복구해 주는 스크립트
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from unicodedata import normalize | |
import glob | |
import os | |
def nfd2nfc(data): | |
return normalize('NFC', data) | |
if len(sys.argv) > 1: | |
dirname = sys.argv[1] | |
diritems = glob.glob(os.path.join(dirname, '*')) | |
new_diritems = list(map(lambda x: nfd2nfc(x), diritems)) | |
for src, dst in zip(diritems, new_diritems): | |
os.rename(src, dst) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage