Both include
flags needs to go before exclude
. The -z, --compress
will compress the files during transfer and the -m, --prune-empty-dirs
will delete empty folders in destination.
rsync -avmz --include="*/" --include="*.sh" --exclude="*" "$from" "$to"