21 lines
440 B
Python
21 lines
440 B
Python
from sys import argv
|
|
from os import rename
|
|
from unidecode import unidecode
|
|
|
|
|
|
# whitespaces will be replaced
|
|
# dots are ok
|
|
# do not ruin previous work
|
|
# dashes are ok
|
|
whitelist = [' ', '.', '_', '-']
|
|
|
|
for file in argv[1:]:
|
|
rename(file,
|
|
unidecode
|
|
(
|
|
''.join(ch for ch in file
|
|
if ch.isalnum()
|
|
or ch in whitelist)
|
|
)
|
|
.replace(' ', '_'))
|