2016-12-08 17:15:56 +00:00
|
|
|
from sys import argv
|
|
|
|
from os import rename
|
|
|
|
from unidecode import unidecode
|
|
|
|
|
|
|
|
|
|
|
|
for file in argv[1:]:
|
|
|
|
rename(file,
|
|
|
|
unidecode
|
|
|
|
(
|
|
|
|
''.join(ch for ch in file
|
|
|
|
if ch.isalnum()
|
2016-12-11 09:20:45 +00:00
|
|
|
or ch is ' ' # whitespaces will be replaced
|
|
|
|
or ch is '.' # dots are ok
|
2016-12-11 09:19:34 +00:00
|
|
|
or ch is '_' # do not ruin previous work
|
2016-12-11 09:18:19 +00:00
|
|
|
or ch is '-') # dashes are ok
|
2016-12-08 17:15:56 +00:00
|
|
|
)
|
2016-12-11 09:18:19 +00:00
|
|
|
.replace(' ', '_'))
|
|
|
|
|