diff --git a/backups/app/specs/specs.py b/backups/app/specs/specs.py index bca52fc..5bf5379 100644 --- a/backups/app/specs/specs.py +++ b/backups/app/specs/specs.py @@ -25,7 +25,8 @@ class Spec: raise NotImplementedError() def remove_redundant(self): - tarballs = self.destination.glob('*.tar.gz') + tarballs = sorted(self.destination.glob('*.tar.gz'), + key=os.path.getmtime, reverse=True) if len(tarballs) >= self.limit: for path in tarballs[self.limit - 1:]: