I'm trying to work out the rsync filter syntax to perform complex include/excludes, and trying to achieve the following:
Include /
Exclude /home
Include /home/user1/*
Include /home/user2/subdir/*
I've tried many variations on the filter syntax, and despite reading the man page many time, I cannot get this sort of effect. Rsync filters seem to be very powerful, and I find it hard to believe they couldn't handle a common scenario such as this.
Best Answer
You need to include all of the parent directories down to the desired directory before using the exclude rule.
For instance, I use the following in a backup script:
So in your case you would need something like the following: