Skip to content

Instantly share code, notes, and snippets.

@jankeesvw
Created August 24, 2010 09:24
Show Gist options
  • Save jankeesvw/547262 to your computer and use it in GitHub Desktop.
Save jankeesvw/547262 to your computer and use it in GitHub Desktop.
uploadtotemp() {
if [ $# -lt 1 ]
then
echo -en "\033[0;31mError: Wrong number of arguments.\033[0m Expected one or two, got zero. \n\n Example usage:\n uploadtmp folder/ new-folder-name/ \n"
else
if [ $# -lt 2 ]; then
NEW_FILE_NAME=`date "+%Y%m%d%H%M%S"`-$1
else
NEW_FILE_NAME=$2
fi
growlnotify -m "start uploading to server, please wait"
rsync --recursive --checksum --progress --compress --update -e ssh --delete --exclude-from /Users/jankees/bin/scripts/upload_exclude.txt $1 jankeesvw@base42.nl:~/base42.nl/subdomains/tmp/$NEW_FILE_NAME
echo "http://tmp.base42.nl/$NEW_FILE_NAME" | pbcopy
growlnotify -m "Upload complete, link copied to clipboard: $NEW_FILE_NAME."
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment