rsync exclude hidden files doesnt work!
Both versions you are showing are wrong. You need to use double quotes. The following works and excludes hidden files and directories:
--exclude=".*"
If you only want to exclude hidden directories:
--exclude=".*/"
I use this expression: --exclude=".[!.]*"
Does the job well for me excluding hidden files and directories.
Open a text file exclude_me.txt
and type the following: .[a-z]*
Then execute the following:
rsync -avh --exclude-from='exclude_me.txt' /path/of/Source /path/of/Destination