Skip to content

Instantly share code, notes, and snippets.

@simlun
Last active January 3, 2016 16:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simlun/8489781 to your computer and use it in GitHub Desktop.
Save simlun/8489781 to your computer and use it in GitHub Desktop.
Compare MD5 checksums for all files in a local Dropbox directory with a remote one. Use for example to reconcile your Dropbox directory between your laptop and workstation. You will be surprised over what you may find... Script was written for Mac OS X. You must of course have "Remote Login" enabled (System Preferences/Sharing).
#!/bin/bash -ex
#
# Example usage:
# $ ./dropbox-reconciliation.sh 192.168.0.17
#
REMOTE_HOST=$1
EXCLUDES="-name '*.DS_Store' -or -path './.dropbox.cache*' -or -name 'Icon*' -or -name .dropbox"
EXEC="-type f -exec md5 -r \"{}\" \;"
FIND="find . \! \( $EXCLUDES \) $EXEC"
diff <(cd ~/Dropbox; bash -c "$FIND") \
<(ssh $REMOTE_HOST "cd ~/Dropbox; bash -c \"$FIND\"") \
| less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment