File size: 489 Bytes
a2a1bfa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import os

from font_dataset.utils import get_files

directory_path = "dataset"

files = get_files(directory_path)


def clean_name(file_name: str):
    return (
        file_name.replace("&", "-")
        .replace("@", "-")
        .replace("#", "-")
        .replace("$", "-")
    )


for file_name in files:
    new_file_name = clean_name(file_name)
    if new_file_name != file_name:
        os.rename(file_name, new_file_name)
        print(f"Renamed {file_name} to {new_file_name}")