Delete backup files when local files are deleted


I am a bit confused about how to achieve the following:

I would like to backup some local files to a remote repository, have one snapshot only but delete the backup files when my local file is deleted.

(In case you are wondering why I am doing this, it is because when my local file is deleted, it is moved to another location actually where a different backup policy will take place and that local file will be actually be backed up to a different repository)

Any help will be appreciated.


If I understood you correctly, you should be using rsync instead of restic. It is fairly easy that way:

rsync -Pavth --delete source/ target/

Be aware that the target may well be a user@host:/path kind of situation.


Exactly what @nicnab wrote. You are describing a use case that is met/solved by a synchronization software, not backup software.

Besides rsync (which is great, it can definitely do what you want) there’s also rclone that can sync between many different types of backends.

1 Like

Yep I guess this is more of a case of rclone sync as my remote is a cloud provider. Thank you