diff --git a/roles/independent_backup-to-usb/files/backup-to-usb.python b/roles/independent_backup-to-usb/files/backup-to-usb.python index 0ace95ba..41a341d8 100644 --- a/roles/independent_backup-to-usb/files/backup-to-usb.python +++ b/roles/independent_backup-to-usb/files/backup-to-usb.python @@ -40,10 +40,11 @@ def main(): print("Starting synchronization...") try: rsync_command = [ - "rsync", "-abP", "--delete", "--delete-excluded", - "--link-dest=" + previous_version_path, - source_path, current_version_path + "rsync", "-abP", "--delete", "--delete-excluded" ] + if previous_version_path is not None: + rsync_command.append("--link-dest=" + previous_version_path) + rsync_command.extend([source_path, current_version_path]) rsync_output = subprocess.check_output(rsync_command, stderr=subprocess.STDOUT, text=True) print(rsync_output)