Matt Komarnicki
Matt Komarnicki

Reputation: 5432

Backup using rsync apparently does not remove files and folders that does not exist anymore on source

I'm using very handy rsync command which allows me to have a backup of particular folders on a specific volumes.

I call rsync with following parameters:

rsync -avzP

To be explicit, when I want to do a backup of all pictures and Lightroom catalogs I call:

rsync -avzP /Volumes/SLICK-2TB/Pictures /Volumes/SLICK-PICTURES-BACKUP

So SLICK-2TB is my source drive and SLICK-PICTURES-BACKUP is my destination drive.

My problem is, whenever I delete / remove a file on source, the change is not reflected on destination. In other words, all new stuff will be always archived on backup volume, but things that don't exist on the source, will be left intact on destination.

Is there a particular attribute that I could add to -avzP that will help me achieve / solve the problem?

Thanks.

Upvotes: 0

Views: 265

Answers (1)

laurent
laurent

Reputation: 90863

You need to use the --delete argument to delete the files on the destination.

Also consider using --dry-run first to make sure you aren't deleting the wrong files. I guess the reason --delete is not a default argument (or part of -a) is that it can wipe out the destination if it's not set correctly.

Upvotes: 1

Related Questions