add .back suffix to database backups

This commit is contained in:
jesopo 2019-10-14 18:13:43 +01:00
parent fe16c0132f
commit e58e9a2058

View file

@ -15,7 +15,7 @@ class Module(ModuleManager.BaseModule):
def _backup(self, timer):
location = self.bot.database.location
files = glob.glob("%s.*" % location)
files = glob.glob("%s.*.back" % location)
files = sorted(files)
while len(files) > 4:
@ -23,7 +23,7 @@ class Module(ModuleManager.BaseModule):
files.pop(-1)
suffix = datetime.datetime.now().strftime("%y-%m-%d.%H:%M:%S")
backup_file = "%s.%s" % (location, suffix)
backup_file = "%s.%s.back" % (location, suffix)
shutil.copy2(location, backup_file)
timer.redo()