--delete
This tells rsync to delete any files on the receiving side that
aren’t on the sending side. Files that are excluded from
transfer are excluded from being deleted unless you use
--delete-excluded.
This option has no effect if directory recursion is not
selected.
This option can be dangerous if used incorrectly! It is a very
good idea to run first using the dry run option (-n) to see
what files would be deleted to make sure important files aren’t
listed.
If the sending side detects any I/O errors then the deletion of
any files at the destination will be automatically disabled.
This is to prevent temporary filesystem failures (such as NFS
errors) on the sending side causing a massive deletion of files
on the destination. You can override this with the --ignore-
errors option.