I use my NAS to back up several smaller systems that monitor the solar plant, using rsync. It works great. Now I want to back up the entire NAS drive.
There are subdirectories for each linux machine - 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.
In the past I excluded the /lost+found
directories but didn't think about /.trash-1000
and now there are a lot of them.
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.
So let's start with .Trash and I think the answer will help me if I find others that I originally forgot to exclude.
Obviously, one solution is to delete the entire directory for each server in turn and then re-run a full rsync with the new set of exclusions.
But that is a lot of work, to say the least.
So my question is, when I make a full rsync of the NAS drive, is there a generic way to exclude all .Trash-1000 folders? If this works, I may swap the drives and resume operations with the cleaner one.
I'm looking for something like this:
--exclude="*.Trash*"
...so it would not copy them, regardless of their location in the directory structure.
I really want to know how to do this with rsync, and am looking for a solution to the problem of how adding excludes causes rsync to skip them rather than deleting them.
Alternatively, instead of doing it during the rsyncs, I would welcome an answer that would show me how to seek and destroy these directories on the original NAS drive.
rsync - How to make it delete directories or files recently added to the exclusions list
*.Trash*
directories that were already copied?--delete-before
and/or--delete-after
options as mentioned on the Rsync - Man. I think the Robocopy function you are referring to is the/PURGE
option and I think one of those two or maybe both will do what you need—simple enough to test.