# rsync -avz --include='*.rpt' --exclude='*' /opt /tmp/2 -n
sending incremental file list
sent 10 bytes received 12 bytes 44.00 bytes/sec
total size is 0 speedup is 0.00 (DRY RUN)
With slash at the end in SOURCE.
# rsync -avz --include='*.rpt' --exclude='*' /opt/ /tmp/2 -n
sending incremental file list
./
a.rpt
b.rpt
sent 67 bytes received 21 bytes 176.00 bytes/sec
total size is 8 speedup is 0.09 (DRY RUN)
Its quite opposite to what you are speaking !! And only *.rpt syncs when you have / at the end !
-a, --archive archive mode, equivalent to -rlptgoD
-r, --recursive recurse into directories
-u, --update update only (don't overwrite newer files)
-v, --verbose increase verbosity
the first 'include' is to ensure recursiveness
the second 'include' is the actual inclusion rule
finally use an exclude to fence off everything else
The real trick is that 'include' and 'exclude' have to come in pair to work properly, so you either go : include <> then exclude <PATTERN>, or exclude <> then include <PATTERN>
Thanks heaps for the reply. Yous slash at the end of the SOURCE was a real big hint for me. Much appreciate! ': )