Skip to content

Commit a957dcb

Browse files
REFACTOR: Properly placing the Deletion Statistics Print in the 'Folder Size Tagger' Python Project
1 parent 288462a commit a957dcb

2 files changed

Lines changed: 6 additions & 10 deletions

File tree

Folder Size Tagger/main.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -657,18 +657,16 @@ def main():
657657
new_name = build_indexed_name(index, clean_name, size_gb) # Build the final indexed and suffixed name
658658
perform_safe_rename(path, new_name) # Rename directory safely avoiding collisions
659659

660-
# Implement logic here
660+
print(
661+
f"{BackgroundColors.GREEN}Total files deleted: {BackgroundColors.CYAN}{DELETION_STATS['files_deleted']}{BackgroundColors.GREEN} | Total dirs deleted: {BackgroundColors.CYAN}{DELETION_STATS['dirs_deleted']}{BackgroundColors.GREEN} | Total deleted size: {BackgroundColors.CYAN}{convert_bytes_to_gb(DELETION_STATS['bytes_deleted']):.2f}GB{Style.RESET_ALL}"
662+
) # Output aggregated deletion statistics
661663

662664
finish_time = datetime.datetime.now() # Get the finish time of the program
663665

664666
print(
665667
f"{BackgroundColors.GREEN}Start time: {BackgroundColors.CYAN}{start_time.strftime('%d/%m/%Y - %H:%M:%S')}\n{BackgroundColors.GREEN}Finish time: {BackgroundColors.CYAN}{finish_time.strftime('%d/%m/%Y - %H:%M:%S')}\n{BackgroundColors.GREEN}Execution time: {BackgroundColors.CYAN}{calculate_execution_time(start_time, finish_time)}{Style.RESET_ALL}"
666668
) # Output the start and finish times
667669

668-
print(
669-
f"{BackgroundColors.GREEN}Total files deleted: {BackgroundColors.CYAN}{DELETION_STATS['files_deleted']}{BackgroundColors.GREEN} | Total dirs deleted: {BackgroundColors.CYAN}{DELETION_STATS['dirs_deleted']}{BackgroundColors.GREEN} | Total deleted size: {BackgroundColors.CYAN}{convert_bytes_to_gb(DELETION_STATS['bytes_deleted']):.2f}GB{Style.RESET_ALL}"
670-
) # Output aggregated deletion statistics
671-
672670
print(
673671
f"{BackgroundColors.BOLD}{BackgroundColors.GREEN}Program finished.{Style.RESET_ALL}"
674672
) # Output the end of the program message

Folder Size Tagger/main_subdirs.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -830,18 +830,16 @@ def main():
830830
new_name = build_indexed_name(index, clean_name, size_gb) # Build the final indexed and suffixed name
831831
perform_safe_rename(path, new_name) # Rename directory safely avoiding collisions
832832

833-
# Implement logic here
833+
print(
834+
f"{BackgroundColors.GREEN}Total files deleted: {BackgroundColors.CYAN}{DELETION_STATS['files_deleted']}{BackgroundColors.GREEN} | Total dirs deleted: {BackgroundColors.CYAN}{DELETION_STATS['dirs_deleted']}{BackgroundColors.GREEN} | Total deleted size: {BackgroundColors.CYAN}{convert_bytes_to_gb(DELETION_STATS['bytes_deleted']):.2f}GB{Style.RESET_ALL}"
835+
) # Output aggregated deletion statistics
834836

835837
finish_time = datetime.datetime.now() # Get the finish time of the program
836838

837839
print(
838840
f"{BackgroundColors.GREEN}Start time: {BackgroundColors.CYAN}{start_time.strftime('%d/%m/%Y - %H:%M:%S')}\n{BackgroundColors.GREEN}Finish time: {BackgroundColors.CYAN}{finish_time.strftime('%d/%m/%Y - %H:%M:%S')}\n{BackgroundColors.GREEN}Execution time: {BackgroundColors.CYAN}{calculate_execution_time(start_time, finish_time)}{Style.RESET_ALL}"
839841
) # Output the start and finish times
840842

841-
print(
842-
f"{BackgroundColors.GREEN}Total files deleted: {BackgroundColors.CYAN}{DELETION_STATS['files_deleted']}{BackgroundColors.GREEN} | Total dirs deleted: {BackgroundColors.CYAN}{DELETION_STATS['dirs_deleted']}{BackgroundColors.GREEN} | Total deleted size: {BackgroundColors.CYAN}{convert_bytes_to_gb(DELETION_STATS['bytes_deleted']):.2f}GB{Style.RESET_ALL}"
843-
) # Output aggregated deletion statistics
844-
845843
print(
846844
f"{BackgroundColors.BOLD}{BackgroundColors.GREEN}Program finished.{Style.RESET_ALL}"
847845
) # Output the end of the program message

0 commit comments

Comments
 (0)