Created
April 16, 2015 13:45
-
-
Save amiraliakbari/3db0503985e9ee81c555 to your computer and use it in GitHub Desktop.
Fix special characters in filenames
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
#!/usr/bin/env python | |
def rr(dir): | |
for d in os.listdir(dir): | |
dd = d.replace('\xef\x80\xa2', '-') | |
if d != dd: | |
os.rename(os.path.join(dir, d), os.path.join(dir, dd)) | |
child = os.path.join(dir, dd) | |
if os.path.isdir(child): | |
rr(child) | |
rr('/home/Morteza/Downloads/') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment