Use Rsync to do a full one-way sync

Rsync by default will act like a copy, and add new files from the source to the target, but not delete.

Sometimes, you want to make a full one-way sync, meaning, make the target look exactly like the source, including deleting files in the target if they no longer exist in the source.

This is really simple as follows:

rsync -avhP --delete /path/to/source/ tony@desthostname:/path/to/target/

In this example:

As always, rsync will keep track and save progress, so you can interrupt the copy and resume it anytime.

Remember that rsync cares about whether you type /source/ or /source.
/source will create a directory called “source” in your target folder.
/source/ will copy the contents of the source directory into the target directory.

You should dry-run your changes with rsync -n to ensure you don't accidentally delete files!