I have two RHEL 7 servers.
On my Source I have the following directories
/sourcestuff/testresync
/sourcestuff/testresync/incl1
/sourcestuff/testresync/incl1/test1.txt
/sourcestuff/testresync/incl2
/sourcestuff/testresync/incl2/test2.txt
/sourcestuff/testresync/excl3
/sourcestuff/testresync/excl3/test2.txt
/sourcestuff/testresync/excl4
/sourcestuff/testresync/excl4/test2.txt
On my Destination I have the following directories
/destinationstuff/testresync
/destinationstuff/testresync/incl1
/destinationstuff/testresync/incl2
/destinationstuff/testresync/excl3
/destinationstuff/testresync/excl4
What I am trying to do is copy the data from my Source to my Destination and exclude the /sourcestuff/testresync/excl3 and /sourcestuff/testresync/excl4 from the Source
What I have tried
rsync -av --relative /sourcestuff/testrsync/./ --exclude '/sourcestuff/testrsync/excl3/' --exclude '/sourcestuff/testrsync/excl4/' user@SERVERIP:/destinationstuff/testrsync
I have read the documentation that the -exclude option relies on the source but everything I try the excl3 and excl4 data still gets transferred.
I have also tried the other way does not work
What I want my Destination to look like:
/destinationstuff/testresync
/destinationstuff/testresync/incl1
/destinationstuff/testresync/incl1/test1.txt
/destinationstuff/testresync/incl2
/destinationstuff/testresync/incl2/test2.txt
/destinationstuff/testresync/excl3
/destinationstuff/testresync/excl4