Skip to content

Commit

Permalink
keep only last 3 backups...
Browse files Browse the repository at this point in the history
  • Loading branch information
Barsoomx committed Apr 26, 2021
1 parent 591357a commit 3e817d4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions update_DBM.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,16 @@ def map_directory(repo_name, folder_glob):

print("BACKUP: Backup finished")

backups_folder = Path(f"./repositories/{repo_name}-backups/")
print("BACKUP: Cleaning older backups if they exist... Keeping only last 3")

sorted_backups = [entry for entry in sorted(backups_folder.iterdir(), key=lambda x: x.name, reverse=True)]
for path in sorted_backups[3:]:
print(f"BACKUP: removing {path}")
shutil.rmtree(path)

print("BACKUP: Backup clean complete.")

return addons

print("UPDATER: directory incorrect, PLEASE place in folder with Wow.exe (WoW root folder)")
Expand Down

0 comments on commit 3e817d4

Please sign in to comment.