Skip to content

Instantly share code, notes, and snippets.

@karrick
Created April 17, 2020 22:47
Show Gist options
  • Save karrick/174dec445aae692c3365b2489f4d59ca to your computer and use it in GitHub Desktop.
Save karrick/174dec445aae692c3365b2489f4d59ca to your computer and use it in GitHub Desktop.
overwrite
#!/bin/bash
remote=some.remote.host
OPTIND=1
while getopts :r: option 2>/dev/null
do
case $option in
r) remote="$OPTARG" ;;
\:) echo >&2 "fatal: option [$OPTARG] requires an argument\n" ;;
\?) echo >&2 "fatal: unknown argument [$OPTARG]\n" ;;
esac
done
shift $(($OPTIND-1))
if [ -z "$remote" ] ; then
echo >&2 "usage: $(basename $0) [-r some.remote.host]"
exit 2
fi
relative="${PWD#$HOME/}/"
time rsync -ai --delete --exclude ._DS_Store --exclude build ./ $remote:$relative
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment