Question about rsync mirroring

rsync
backup
#1

OK, another Linux question. I’ve been looking into the rsync command. And I see that it can copy only files that has changed and the new files that were created. But to truly keep the files in sync (mirrored) does rsync remove the deleted files?

1 Like
Another Simple Question
#2

That is the first step to using rsync.

Last time I checked, to make a mirror (i.e. allowing to also delete files on the destination) you just have to choose the appropriate command line options for the rsync command.
You can read the rsync manual here.

1 Like
#3

this was one of the first questions i had when thinking about using rsync as well. i added the --delete option to mine after the single letter options. so mine is rsync -rahP --delete <source> <destination>. i’m pretty sure i got that from the arch wiki:

https://wiki.archlinux.org/index.php/rsync

2 Likes