Sadly, there is no built in method in Rsync at the time writing.
Mike Fitzpatrick's solution will work fine, however if you have a very large directory tree, you may want to do something that doesn't make rsync go through all the files again
EDIT:
There is also a bug where it wont delete a destination file... the more and more I look at it, this solution is broken... I am leaving it up becase it may work in your case and also if someone wants to fix it.
Also, someone should submit a formal feature request to https://bugzilla.samba.org/enter_bug.cgi?product=rsync
I wrote this script:
#! /bin/bash
# Make a temp file for storing the output of rsync
tmpfile=$( mktemp ) &&
# Do all the hard work ( get the list of files we need to update ),
# but dont actually change the filesystem
rsync --dry-run --out-format='RSYNC_CONFIRM %i %n%L' "$@" | grep RSYNC_CONFIRM | awk '{ print $3 }' > $tmpfile &&
# Output to the user what we propose to do
rsync --dry-run --itemize-changes --files-from=$tmpfile "$@" &&
# Alternatively, we could just output $tmpfile... but whatever...
read -p "Continue? (y/n)?" &&
if [[ $REPLY = [yY] ]]
then
{
rsync --files-from=$tmpfile "$@"
}
fi
rm $tmpfile
Try pasting the script into a file called rsync-confirm.bash
Then chmod +x rsync-confirm.bash
Then ./rsync-confirm.bash -rvh /etc/ /tmp/etc/
This script might be a little buggy, I noticed that it doesn't really like it if you don't have a trailing slash on the source directory...