This rsync command will create a full backup of a folder, deleting extraneous files at the destination, preserving all file permissions / ownerships and displaying progress. Useful for creating / syncing a regular backup to an external drive or network share without re-transferring unmodified files.
rsync -aP --del /path/to/src /path/to/dest
Note that omitting a trailing slash on the src
path will cause rsync to create the src
directory at the dest
location.