I'm trying to sync a large tree on Linux, but include and exclude certain files/directories. My question is regarding rsync's --relative option and how relative paths are handled. Directory structures appear something like:
/x/z1/company1/file1 /x/z2/company2/file1 /x/z3/company3/dir1/file3 /x/z4/company1/dir2 /x/z5/company1/dir3/file4
I want to transfer directories and files under 'company?' non-recursively. This (so far) appears to do what I am after:
rsync -a --relative /x/./z? --include '/x/*/*/*' --exclude '/x/*/*/*/*' a@b:/x
How could I specify the inc/excl rules as relative paths? What would this do?
rsync -a --relative /x/./z? --include '*/*/*/*' --exclude '*/*/*/*/*' a@b:/x
How will the patterns match? In order words, are the patterns relative to /x or to /x/./z ?