Look for the last backup after removing old ones

With --remove-before-backup, the last backup was selected for
--link-dest before old backups were removed, so with keep=0 rsync
was given a directory that no longer existed.
This commit is contained in:
Fuxino
2026-10-08 18:11:25 +02:00
parent d0f888cbb4
commit 30e4416f8f
+3 -1
View File
@@ -515,7 +515,6 @@ class Backup:
_notify('Starting backup...') _notify('Starting backup...')
self.define_backup_dir() self.define_backup_dir()
self.find_last_backup()
fd, self._inputs_path = mkstemp(prefix='tmp_inputs', text=True) fd, self._inputs_path = mkstemp(prefix='tmp_inputs', text=True)
count = 0 count = 0
@@ -549,6 +548,9 @@ class Backup:
if self.keep != -1 and self._remove_before: if self.keep != -1 and self._remove_before:
self.remove_old_backups() self.remove_old_backups()
# Only look for the last backup now, as it may have been removed above
self.find_last_backup()
logger.info('Copying files. This may take a long time...') logger.info('Copying files. This may take a long time...')
if self._last_backup == '': if self._last_backup == '':