Last active
March 27, 2023 15:13
-
-
Save ozgurkalan/633fcf098d6cbc41062f94835f698107 to your computer and use it in GitHub Desktop.
zipper
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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