Question

Currently I am using rsync -avz daniel@remotepc:/var/www /home/localuser/rsync --exclude='/var/www/somefolder'", but if a file is deleted on remotepc, I want it to be deleted on the local copy. I wasn't sure if --delete was to be used here, and just wanted to check before I do something stupid and end up losing data.

Was it helpful?

Solution

Why do you care about loosing data if you may only loose local copy? Also, rsync have -n option, which is dry run - it will print everything it would do, but will not perform any changes.

Also, if you're too afraid losing local copy (maybe data is too large to re-download), you could use -b option, which will rename files to filename~ instead of deleting it.

Anyway --delete is what you need, and even maybe --delete-excluded.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top