auto_backup
auto_backup copied to clipboard
Conflict between db names
The condition "if rec.name in fullpath:" (line 279 of auto_backup.py branch 12.0) may cause deletion of wrong files if:
- I have two databases "foo" and "foobar" ("foo" in "foobar" is True)
- I save the backups in the same folder for both
- Autoremove config is different
Maybe consider a regex...
Hmm, indeed. Good catch, I never thought about that case. On the wishlist/todo list.
Another thing: I think it's better to get the date from the file name, rather than with os.stat. Because recently I moved all backups to another folder, which changed st_ctime. This is all the more serious since I added a condition to always keep one backup per month:
if createtime.day != 1:
_logger.info("Delete local out-of-date file: %s", fullpath)
os.remove(fullpath)
But since st_ctime changed, I lost those backups.