Here are a couple of bash shell scripts I wrote to help keep my documents synchronized across machines.

aru

#!/bin/bash

# aru - Angelo's rsync uploader

# Options
# -r              : recursive
# -t              : preserve time
# -l              : symlinks as symlinks
# -p              : preserve permissions
# -v              : verbose
# -e /usr/bin/ssh : remote shell [ssh]
# -z              : compress data
# --delete-after  : delete missing files on receiver
#                   after transfer complete
# --progress      : display progress
options="-rtlpvz -e /usr/bin/ssh --delete-after --progress"

# The server and directory for the repository
server="descartes"
directory="~/sync"

if [ $# -lt 1 ]
then
   echo "usage: $(basename ${0}) SOURCE..."
   echo "Uploads SOURCE... files or directories to ${server}:${directory}"
   exit 1
fi

for arg in $@
do
   arg=`echo $arg | sed -e 's/\/\$//g'`
   args="$args $arg"
done

rsync ${options} $args ${server}:${directory}

exit 0



ard

#!/bin/bash

# aru - Angelo's rsync downloader

# Options
# -r              : recursive
# -t              : preserve time
# -l              : symlinks as symlinks
# -p              : preserve permissions
# -v              : verbose
# -e /usr/bin/ssh : remote shell [ssh]
# -z              : compress data
# --delete-after  : delete missing files on receiver
#                   after transfer complete
# --progress      : display progress
options="-rtlpvz -e /usr/bin/ssh --delete-after --progress"

# The server and directory for the repository
server="descartes"
directory="~/sync"

if [ $# -lt 1 ]
then
   echo "usage: $(basename ${0}) SOURCE..."
   echo "Downloads SOURCE... files or directories from ${server}:${directory}"
   exit 1
fi

for arg in $@
do
   arg=`echo $arg | sed -e 's/\/\$//g'`
   args="$args $arg"
done

rsync ${options} ${server}:${directory}/$args .

exit 0