backups = [[x, re.match('.*(\d\d\d\d-\d\d-\d\d).*', x)] for x in backups]
backups = [[x[0], strptime(x[1].groups()[0], '%Y-%m-%d')] for x in backups]
-keep = backups[:4]
-backups = backups[4:]
+keep = backups[:3]
+backups = backups[3:]
monthlys = {}
for x in backups:
month = (x[1].tm_year, x[1].tm_mon)
if month not in monthlys:
monthlys[month] = x
- if len(monthlys) > 5:
+ if len(monthlys) > 4:
break
keep.extend(monthlys.values())