From b2beb5765b9700d38cbc28bed348adac1417676f Mon Sep 17 00:00:00 2001 From: Matt Troutman Date: Wed, 2 Oct 2024 13:33:08 -0500 Subject: [PATCH] Adding function to remove `.setup_complete` files. --- .fontfoldercleanup/cleanup.py | 9 ++++++++- .fontfoldercleanup/remove_ds_and_clean_empty_folders.py | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .fontfoldercleanup/remove_ds_and_clean_empty_folders.py diff --git a/.fontfoldercleanup/cleanup.py b/.fontfoldercleanup/cleanup.py index 3bfbb73..d3ea2cf 100644 --- a/.fontfoldercleanup/cleanup.py +++ b/.fontfoldercleanup/cleanup.py @@ -204,7 +204,14 @@ def unzip_if_no_fonts(root_path=font_location): os.system(f'unzip {zip_file_path} -d {dir_path}') print(f"Unzipped {zip_file_path}") - +def remove_setup_complete_files(root_path=font_location): + # walk through the root path directory and remove all files named ".setup_complete" + for root, dirs, files in os.walk(root_path): + for file in files: + if file == '.setup_complete': + file_path = os.path.join(root, file) + os.remove(file_path) + print(f"Removed .setup_complete file: {file_path}") if __name__ == '__main__': diff --git a/.fontfoldercleanup/remove_ds_and_clean_empty_folders.py b/.fontfoldercleanup/remove_ds_and_clean_empty_folders.py new file mode 100644 index 0000000..3128181 --- /dev/null +++ b/.fontfoldercleanup/remove_ds_and_clean_empty_folders.py @@ -0,0 +1,6 @@ +import cleanup + +if __name__ == '__main__': + cleanup.remove_ds_store_files() + cleanup.remove_setup_complete_files() + cleanup.remove_empty_folders()