Last Updated: February 25, 2016
·
579
· rane

Dropbox deploy script

Useful when working with static web pages.

Put this in the directory you're working in and running the script will copy the directory under ~/Dropbox/Public.

Accepts an optional argument that overrides the name of the directory when copied to Public/.

Some extras to uncomment at the bottom of the script.

#!/bin/bash

ARG=$1
set -x verbose #echo on

if [ -z "$ARG" ]; then
  TARGET=$(basename $(pwd))
else
  TARGET=$ARG
fi

rsync \
  --delete-excluded \
  --exclude $(basename $0) \
  --exclude '.git*' \
  --exclude 'node_modules/' \
  -va . ~/Dropbox/Public/$TARGET

# Optional stuff

FILE_TO_LINK="index.html"
DROPBOX_ID=xxxxxx # Get a public link for something to get the ID
URL="https://dl.dropboxusercontent.com/u/$DROPBOX_ID/$TARGET/$FILE_TO_LINK"

# Copy public link to the clipboard
# echo -n $URL | pbcopy

# Open the directory in Finder
# open ~/Dropbox/Public/$TARGET

Gist at https://gist.github.com/raine/6404980