Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
babsonnexus authored Dec 19, 2024
1 parent f3b611d commit 981546a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions slm.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from jinja2 import TemplateNotFound

# Top Controls
slm_version = "v2024.12.18.1525"
slm_version = "v2024.12.18.0847"

slm_port = os.environ.get("SLM_PORT")
if slm_port is None:
Expand Down Expand Up @@ -4006,7 +4006,12 @@ def generate():
def create_backup():
src_dir = program_files_dir
dst_dir = backup_dir


# List of items to be excluded from backup
exclude_items = [
'temp.txt'
]

# Determine the max number of backups to keep
max_backups = 3
try:
Expand All @@ -4022,9 +4027,10 @@ def create_backup():
backup_subdir = os.path.join(dst_dir, timestamp)
os.makedirs(backup_subdir, exist_ok=True)
for item in os.listdir(src_dir):
src_item = os.path.join(src_dir, item)
if os.path.isfile(src_item):
shutil.copy2(src_item, backup_subdir)
if item not in exclude_items:
src_item = os.path.join(src_dir, item)
if os.path.isfile(src_item):
shutil.copy2(src_item, backup_subdir)

# Clean up old backups if there are more than max_backups
backups = sorted(os.listdir(dst_dir))
Expand Down

0 comments on commit 981546a

Please sign in to comment.