My site is hosted from a “public_html” directory that also contains files unrelated to my Hugo site. (I can’t remember how this came to be. Perhaps I should change it in some way.)
When I previously had an Octopress site, I used a “rsync-filter” file in which all these unrelated items were listed, each preceded by “P” Rsync would leave these alone.
Octopress has a “rake deploy” command. A Rakefile contained the following:
(I used the ${DIR} formulation because I had to prescribe the entire path to my web directory on the server.)
In the Exclude.txt file, I list all the excluded items, one per line. For an excluded directory, I added a trailing slash after the directory name.
For those relatively new to rsync like me, I first tested the command with the -n ( a dry run) and an extra -v (verbose) option to carefully inspect what rsync was going to do.