* commit 'd7fe57b9d0':
  Adding Cleanup script
  Initial commit (not cleaned up)
This commit is contained in:
Matt Troutman 2024-09-16 20:35:24 -05:00
commit 40a941786a
No known key found for this signature in database
378 changed files with 4988 additions and 0 deletions

View file

View file

@ -0,0 +1,150 @@
import os
import time
from fileinput import filename
bad_phrases = [' Free',
'TBJ ',
' - Zarma Type',
' Only',
' Personal use',
' PERSONAL USE',
' SVG',
' Free Non-Commercial Use',
' Free for Personal Use',
' Free for personal use',
' Personal Use',
' Personl Use Only',
' Personl Use',
' Free To Try Personal Use Only',
' - Personal Use Only',
' - DCU',
' - Demo',
' - Free for Personal Use',
' - Free for personal use',
' - Free for personal use only',
' Demo',
' DCU',
' To Try',
' - Free Personal Use Only',
' - Free Personal Use',
' - Personal use Only',
' -',
"'",
'Non-Commercial Use',
]
def remove_ds_store_files(path):
"""
Recursively removes .DS_Store files within the given path.
Args:
path (str): The path to the directory to be checked and cleaned.
Returns:
None
"""
for root, dirs, files in os.walk(path):
for file in files:
if file == '.DS_Store':
file_path = os.path.join(root, file)
os.remove(file_path)
print(f"Removed .DS_Store file: {file_path}")
def remove_empty_folders(path):
"""
Recursively removes empty directories within the given path, except for .git and .env directories and their subdirectories.
Args:
path (str): The path to the directory to be checked and cleaned.
Returns:
None
"""
for root, dirs, files in os.walk(path, topdown=False):
for dir in dirs:
dir_path = os.path.join(root, dir)
if '.git' in dir_path.split(os.sep) or '.env' in dir_path.split(os.sep):
continue
if not os.listdir(dir_path):
os.rmdir(dir_path)
print(f"Removed empty folder: {dir_path}")
# Usage
def remove_bad_phrases(path):
"""
Recursively removes bad phrases from the names of directories at the root of the given path.
Args:
path (str): The path to the directory to be checked and cleaned.
Returns:
None
"""
while True:
removed_any = False
for root, dirs, files in os.walk(path):
for dir in dirs:
dir_path = os.path.join(root, dir)
for phrase in bad_phrases:
if phrase in dir:
new_dir = dir.replace(phrase, '')
new_dir_path = os.path.join(root, new_dir)
os.rename(dir_path, new_dir_path)
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
removed_any = True
break # Exit the loop after renaming to avoid modifying the same directory multiple times
if not removed_any:
break
# time.sleep(1) # Delay to allow the file system to settle
def collect_orphaned_fonts(path):
"""
Collects orphaned font files at the root of the given path.
Args:
path (str): The path to the directory to be checked for orphaned font files.
Returns:
list: A list of orphaned font files.
"""
orphaned_fonts = []
for file in os.listdir(path):
file_path = os.path.join(path, file)
if os.path.isfile(file_path) and (file.endswith('.otf') or file.endswith('.ttf')):
# Create a directory for the orphaned font
orphan_folder = os.path.join(path, os.path.splitext(file)[0])
if not os.path.exists(orphan_folder):
os.mkdir(orphan_folder)
# Move the font file into the new directory
new_path = os.path.join(orphan_folder, file)
os.rename(file_path, new_path)
orphaned_fonts.append(new_path)
print(f"Moved {file_path} to {new_path}")
return orphaned_fonts
def lowercase_all_the_folders(root_path):
"""
Lowercases all the folders in the root path.
Args:
root_path (str): The path to the directory to be checked and cleaned.
Returns:
None
"""
for dir in os.listdir(root_path):
dir_path = os.path.join(root_path, dir)
if os.path.isdir(dir_path):
new_dir_path = os.path.join(root_path, dir.lower())
os.rename(dir_path, new_dir_path)
print(f"Renamed directory: {dir_path} -> {new_dir_path}")
if __name__ == '__main__':
remove_ds_store_files('/Users/fishy/custom_fonts/')
remove_empty_folders('/Users/fishy/custom_fonts/')
remove_bad_phrases('/Users/fishy/custom_fonts/')
collect_orphaned_fonts('/Users/fishy/custom_fonts/')
lowercase_all_the_folders('/Users/fishy/custom_fonts/')

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
AlphaLyrae-Medium.otf Normal file

Binary file not shown.

BIN
Angular DCU/ANgular.otf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Benford Demo/Benford DEMO.otf Executable file

Binary file not shown.

BIN
Benford Demo/Benford DEMO.ttf Executable file

Binary file not shown.

Binary file not shown.

BIN
Clancy Experience.otf Normal file

Binary file not shown.

Binary file not shown.

BIN
Cucurucho DCU/Cucurucho.otf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
DEPOK CUBISM DCU/Kosmos.otf Normal file

Binary file not shown.

BIN
DK Frozen Memory.otf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
District DCU/District.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Lexa.otf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more