rsync -av --delete --backup --backup-dir=/mnt/backup/deleted /home/user/docs/ /mnt/backup/docs/

Category: Backup & Restore

rsync -av --delete --backup --backup-dir=/mnt/backup/deleted /home/user/docs/ /mnt/backup/docs/

Mirror but keep deleted files in a backup dir

Instead of deleting files outright, --backup moves them into --backup-dir, giving you a safety copy of everything the mirror removes. The backup directory must live outside the sync destination. A safer alternative to plain --delete for important data.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.