Bash

#!/bin/bash# USAGE:# Save this file as whatever.command and make sure this file is executable.# To make it executable, simply open up your Mac's terminal, cd to the folder# where you've saved this file and then run: $ chmod +x whatever.command# # To execute the file, save it in your Desktop or Home folder and simply click on# it whenever you want to sync these folders. Alternatively you could create a cron# job to do this automatically for you.# # To sync multiple folders, simply copy paste the rsync line# and change source and target folders.# Example: sync my GitHub Joomla! template repo to 2 local websites for mult-site testing# Notice the changed path in the second line below...rsync -av --delete ~/Projects/GitHub/myTemplate/ ~/WWW/Joomla25/templates/myTemplate/
rsync -av --delete ~/Projects/GitHub/myTemplate/ ~/WWW/Joomla3x/templates/myTemplate/

Bash

# from http://ask.slashdot.org/comments.pl?sid=2604202&cid=38589562# First I sync from the remote directory to a local base directory:rsync --partial -z -vlhprtogH --delete [email protected]:/etc/ /backup/server/www/etc/base/
#Then I sync that to the daily backup. Files that have not changed are hard-linked between all the days that share them. It very efficient and simple, and retrieving files is as simple as doing a directory search.rsync -vlhprtogH --delete --link-dest=/backup/server/www/etc/base/ /backup/server/www/etc/base/ /backup/server/www/etc/2012-01-04