🤞🏼Maybe closer?

This commit is contained in:
Matt Troutman 2024-10-02 13:45:04 -05:00
parent be9f7e8524
commit 522f6154d0
No known key found for this signature in database

View file

@ -218,6 +218,28 @@ def remove_setup_complete_files(root_path=font_location):
os.remove(file_path)
print(f"Removed .setup_complete file: {file_path}")
def remove_spaces_in_dir_names(root_path=font_location):
for dir in os.listdir(root_path):
dir_path = os.path.join(root_path, dir)
if os.path.isdir(dir_path):
#If directory name contains spaces, replace them with dashes
if ' ' in dir:
new_dir = dir.replace(' ', '-')
new_dir_path = os.path.join(root_path, new_dir)
os.rename(dir_path, new_dir_path)
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
def prepend_folder_name_to_font_dash(root_path=font_location):
for dir in os.listdir(root_path):
dir_path = os.path.join(root_path, dir)
if os.path.isdir(dir_path):
#if the directory doesn't start with 'font-', already, prepend it
if not dir.startswith('font-'):
new_dir = f'font-{dir}'
new_dir_path = os.path.join(root_path, new_dir)
os.rename(dir_path, new_dir_path)
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
if __name__ == '__main__':
remove_ds_store_files()
@ -225,6 +247,8 @@ if __name__ == '__main__':
remove_bad_phrases()
collect_orphaned_fonts()
lowercase_all_the_folders()
add_font_folders_to_each()
# add_font_folders_to_each()
remove_spaces_in_dir_names()
prepend_folder_name_to_font_dash()
remove_ds_store_files()
remove_empty_folders()
remove_empty_folders()