From a716e01e8dfdecf0c1fa33b5618c54f033e5fc5d Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Thu, 10 Mar 2016 12:19:51 +0100 Subject: [PATCH] [FIX] This was removing all databases. --- auto_backup/models/db_backup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/auto_backup/models/db_backup.py b/auto_backup/models/db_backup.py index a312d1347..891ee917c 100644 --- a/auto_backup/models/db_backup.py +++ b/auto_backup/models/db_backup.py @@ -223,13 +223,14 @@ class DbBackup(models.Model): if rec.method == "local": for name in iglob(os.path.join(rec.folder, "*.dump.zip")): - if name < oldest: + if os.path.basename(name) < oldest: os.unlink(name) elif rec.method == "sftp": with rec.sftp_connection() as remote: for name in remote.listdir(rec.folder): - if name.endswith(".dump.zip") and name < oldest: + if (name.endswith(".dump.zip") and + os.path.basename(name) < oldest): remote.unlink(name) @api.multi