Skip to content

Commit e06de7c

Browse files
committed
Fix removing backups when it should not
1 parent 6ec7cdc commit e06de7c

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mdbackup/__main__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,13 @@ def main():
111111
#Cleanup old backups
112112
max_backups = config.get('maxBackupsKept', 7)
113113
backups_list = get_backup_folders_sorted(backups_path)
114-
logger.debug('List of folders available:\n{}'.format('\n'.join(backups_list)))
115-
for old in backups_list[0:(len(backups_list)-max_backups)]:
114+
logger.debug('List of folders available:\n{}'.format('\n'.join([str(b) for b in backups_list])))
115+
for old in backups_list[0:max(0, len(backups_list)-max_backups)]:
116116
logger.warn(f'Removing old backup folder {old}')
117117
try:
118118
shutil.rmtree(old)
119119
except Exception:
120-
logger.exception(f'Could not remove completely {old}')
120+
logger.exception(f'Could not completely remove backup {old}')
121121

122122

123123
if __name__ == '__main__':

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="mdbackup",
8-
version="0.1.2",
8+
version="0.1.3",
99
author="Melchor Alejo Garau Madrigal",
1010
author_email="melchor9000@gmail.com",
1111
description="Small but customizable utility to create backups and store them in cloud storage providers",

0 commit comments

Comments
 (0)