I want to exclude /bar/ from rsync, but only when in folder /foo/.
If I use --exclude '/foo/bar/' , it will only work when rsync is run on foos parent directory, but in our setup, I can't do that.
If I use --exclude '/bar/', it will exclude all /bar/ subdirectories, including /fee/bar/, for example.
What I want to do is only exclude /bar/ when the target directory is /foo/
Is this possible in rsync?
Or do I need to have some wrapper script that inserts the exclude rule it target is /foo/?