Created
October 27, 2021 02:52
-
-
Save theeluwin/0711ae2d3b44be03b4dfb1d2157b9a3e to your computer and use it in GitHub Desktop.
This file contains 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 os | |
from unicodedata import normalize | |
def walk_normalize(target_dir): | |
for root, dirs, files in os.walk(target_dir): | |
for name in files: | |
path = os.path.join(root, name) | |
if name == '.DS_Store': | |
os.remove(path) | |
continue | |
os.rename(path, normalize('NFC', path)) | |
for name in dirs: | |
path = os.path.join(root, name) | |
os.rename(path, normalize('NFC', path)) | |
if __name__ == '__main__': | |
walk_normalize('temp') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment