6

rsync option --delete-excluded implies --delete as well. From man page:

--delete-excluded

In addition to deleting the files on the receiving side that are not on the sending side, this tells rsync to also delete any files on the receiving side that are excluded (see --exclude).

Is there a way to specify only delete file/dir if it was excluded, otherwise don't delete. I have a situation where I backup my homedir on my laptop to my nas device using rsync. I want to continue to delete photos from my laptop but when I sync, I don't want them deleted from nas but for I exclude some dirs from back up using --exclude and want them deleted on NAS as well.

Thanks,

-- TM

migrated from serverfault.com Nov 9 '15 at 21:10

This question came from our site for system and network administrators.

0

The use of filters might meet your requirements:

--filter='P /some/dir'

Related question: How to exclude rsync excludes from delete?

0
rsync -avr  --delete-excluded --include=*.txt /source /* /destination 

May help your needs. Let me know.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy