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


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.


-- TM

2 Answers 2


The use of filters might meet your requirements:

--filter='P /some/dir'

Related question: How to exclude rsync excludes from delete?

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

May help your needs. Let me know.

You must log in to answer this question.