Skip to content

Instantly share code, notes, and snippets.

@ozgurkalan
Last active March 27, 2023 15:13
Show Gist options
  • Save ozgurkalan/633fcf098d6cbc41062f94835f698107 to your computer and use it in GitHub Desktop.
Save ozgurkalan/633fcf098d6cbc41062f94835f698107 to your computer and use it in GitHub Desktop.
zipper
from zipfile import ZipFile, ZIP_DEFLATED
from ozcore import core
def backup_db():
"""Backup the database and py file"""
with ZipFile(
path.joinpath("Backup_" + core.utils.now_prefix("_") + "_db.zip"),
"w",
ZIP_DEFLATED,
compresslevel=9,
) as thezip:
thezip.write(path.joinpath("db.py"), arcname="db.py")
thezip.write(path.joinpath("data.db"), arcname="data.db")
print("Backup is ready....")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment