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
--------------------------------------------------------------------------
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:
--delete-before
and/or--delete-after
options... play and test with those a bit.