0

I use my NAS to back up several smaller systems - 8 of them.

As I have learned more and tuned my exclusions I see a whole lot of leftovers that I forgot to exclude earlier.

Say I decide to exclude all of /var/log for the backups. kern* and messages* in particular can take up many GB of space each, and the contents are totally meaningless in a backup.

Simply adding them to the --exclude list, even with --delete doesn't delete them because exclude makes the rsync program skip them entirely.

It does not operate the same way Robocopy /MIR does.

Is there an answer to this bug?


Ideally, I would like rsync to do it automatically, but perhaps every time I add a new exclude I should just manually clean up old copies instead?

This worked to delete the leftovers:

cd /mnt/full
sudo rm -rf `sudo find -type d -name '.Trash-1000'`

as per the answer to

Ubuntu 16.04 rsync - doing backups of the NAS server, can I tell it to exclude all the .Trash directories?

--------------------------------------------------------------------------

ADDENDUM: Xenoid gave the required answer by pointing out that there is a --delete-excluded switch. I missed that. It is exactly what I have been looking for so this will be automatic from now on. TNX.

Here is a Q&A that talked directly to it, but which never came up in my Goggle Fu:

What exactly will --delete-excluded do for rsync?

1
  • How about the --delete-before and/or --delete-after options... play and test with those a bit. Commented Aug 20, 2017 at 14:55

1 Answer 1

2

man rsync says there is a --delete-excluded option: also delete excluded files on the receiving side.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .