A risky rsync command deserves a preview before it writes to the destination, especially when the live command will update existing files or remove destination-only files. A dry run lets the same source, destination, and options build the transfer list without copying data or deleting files.
The preview should use –dry-run together with –itemize-changes. The dry run keeps rsync from making changes, while itemized output marks new files, changed files, attribute updates, directory touches, and deletions that would happen if the same command ran without –dry-run.
Use the exact options planned for the real sync, including –delete only when the live command should remove destination-only files. The itemized list should match the later real run as long as the source and destination do not change in between, but dry-run progress and transfer statistics are not proof because no file data is transferred.
$ rsync -a --dry-run --itemize-changes /src/ /dest/
The trailing slash on /src/ means rsync previews copying the contents of that directory into /dest/. Remove the slash only when the destination should receive a top-level src directory.
$ rsync -a --dry-run --itemize-changes --delete /src/ /dest/ *deleting obsolete.log >f+++++++++ reports/new-report.txt >f.s....... reports/summary.txt
–delete removes files that exist only on the destination during the real run. Keep it in the dry run if the real mirror should delete those files, and remove it from both commands when destination-only files must stay.
$ rsync -a --itemize-changes --delete /src/ /dest/ *deleting obsolete.log >f+++++++++ reports/new-report.txt >f.s....... reports/summary.txt
Keep –itemize-changes on the live command when the final log should record the changes that were actually applied.