Last active
February 20, 2016 13:11
-
-
Save olivierlemoal/cd7a279e338773c2773b to your computer and use it in GitHub Desktop.
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
#! /usr/bin/env python3 | |
import sys | |
import os | |
from path import path | |
if len(sys.argv) < 2: | |
print("Usage : {} path".format(sys.argv[0])) | |
exit(1) | |
path = path(sys.argv[1]) | |
for file in path.walkfiles(): | |
try: | |
fixed_name = file.encode("iso-8859-1").decode("utf-8") | |
except: | |
continue | |
if fixed_name != file: | |
os.rename(file, fixed_name) | |
print("{} renamed in {}".format(file, fixed_name)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment