Skip to content

Instantly share code, notes, and snippets.

@jsenin
Created March 22, 2022 22:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsenin/de41467a7318f04898fa5945e91799af to your computer and use it in GitHub Desktop.
Save jsenin/de41467a7318f04898fa5945e91799af to your computer and use it in GitHub Desktop.
drop characters non visibles at filenames. Usually because mixed charset codifications
import glob
import shutil
files = glob.glob("/home/jorge/Music/**", recursive=True)
for current in files:
try:
new = current.encode('utf8', 'ignore')
shutil.move(current, new)
except Exception as exc:
print(str(exc))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment