Skip to content

Instantly share code, notes, and snippets.

@raine
Last active December 22, 2015 02:39
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raine/6404980 to your computer and use it in GitHub Desktop.
Save raine/6404980 to your computer and use it in GitHub Desktop.

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 in the bottom of the script.

#!/bin/bash
# https://gist.github.com/6404980.git
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment