Exemple #1
0
def backup_code():
    # zip_new_xnote()
    dirname = "./"
    dest_path = xconfig.CODE_ZIP
    xutils.zip_dir(dirname, dest_path,
        filter = lambda x: x.endswith((".py", ".html", ".js", ".css", ".bat", ".png", ".md")) \
            and not x.startswith("./data"))
Exemple #2
0
def backup_data():
    dirname = xconfig.DATA_DIR
    dest_path = os.path.join(dirname, "data.zip")
    xutils.zip_dir(dirname,
                   dest_path,
                   excluded=[
                       "data.db", "code.zip", "dictionary.db", "app", "backup",
                       "tmp", "log"
                   ])
Exemple #3
0
def backup_files():
    dirname = xconfig.DATA_DIR
    dest_path = os.path.join(dirname, "files.zip")
    dirname2 = os.path.join(dirname, "files")
    xutils.zip_dir(dirname2, dest_path)
Exemple #4
0
def chk_db_backup():
    dirname = xconfig.DB_DIR
    destfile = os.path.join(xconfig.BACKUP_DIR, time.strftime("db.%Y-%m.zip"))
    xutils.zip_dir(dirname, destfile)
Exemple #5
0
def chk_scripts_backup():
    dirname = xconfig.SCRIPTS_DIR
    destfile = os.path.join(xconfig.BACKUP_DIR,
                            time.strftime("scripts.%Y-%m.zip"))
    xutils.zip_dir(dirname, destfile)
Exemple #6
0
 def POST(self):
     dirname = xutils.get_argument("dirname")
     destname = xutils.get_argument("destname")
     xutils.zip_dir(dirname, os.path.join(dirname, destname))
     return xtemplate.render_text(html, dirname=dirname, destname=destname)