#!/bin/sh # RSYNC wrapper to exclude files by default # https://unix.stackexchange.com/questions/21701/how-can-i-exclude-files-by-default-with-rsync # Set path to the rsync binary RSYNC=/usr/bin/rsync # Look for these exclude files IGNORE_FILES=(~/.rsyncignore ./.gitignore ./.rsyncignore) EXCLUDE_FROM="" for f in ${IGNORE_FILES[@]}; do if [[ -e $f ]]; then EXCLUDE_FROM="$EXCLUDE_FROM --exclude-from=$f " fi done $RSYNC $EXCLUDE_FROM "$@"