rsync --include-from not working
I found the solution. I took me two full days to find it. I hope this help you to not spend that much time.
The first problem was that the sub-directory subdir
in /usr2/subdir
was included and I did not wanted that whole directory to be included, I just wanted it to be the base directory, so it requires a slash at the end as in /usr2/subdir/
, so my new command looks like:
rsync -ruvv --rsh=ssh --include-from=zz-rsync-test.prod.incl /usr2/subdir/ remoteSrv:/tmp/.
Note that I added an extra v
option in the command line (-ruvv
) to get more detail of what was excluded or included at the moment of running the command. With the base directory fixed and the extra v
it was a little easier to built the right include file:
+ data/
+ data/text_forms/
+ data/text_forms/*.per
+ data/text_forms/*.42f
+ data/text_forms/*.xml
+ data/text_forms/*.xml.*
- *
All the +
lines have to be placed before the - *
, specially for directories as I had to explicitly include each directory to scan even if I don't want to get files directly inside those directories. I did a test adding a data/anyTestFile1
and a data/text_forms/anyTestFile2
because I was not sure if those where going to be picked up, but they did not, so it is doing what I want.... finally.