rsync --include option does not exclude other files
--include
is for which files you want to not --exclude
. Since you haven't excluded any in future arguments, there's no effect. You can do:
from=/home/xxxrsync -zvr --include="*.sh" --include="*/" --exclude="*" "$from" root@$host:/home/tmp/
To recursively copy all .sh files (the extra --include
to not skip directories that could contain .sh files)
On thing to add, at least on my machines (FreeBSD and OS X), this does not work:
rsync -aP --include=*/ --include=*.txt --exclude=* * /path/to/dest
but this does:
rsync -aP --include=*/ --include=*.txt --exclude=* . /path/to/dest
Yes, wildcarding the current directory seem to override the exclude.