Skip to content

Instantly share code, notes, and snippets.

@matthewcosgrove
Last active December 23, 2018 15:29
Show Gist options
  • Save matthewcosgrove/48c4c4aaab0f171fae30a47c1694460b to your computer and use it in GitHub Desktop.
Save matthewcosgrove/48c4c4aaab0f171fae30a47c1694460b to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
: "${DROPBOX_FOLDER_TO_KEEP:? DROPBOX_FOLDER_TO_KEEP must be set e.g. DROPBOX_FOLDER_TO_KEEP=CapoeiraSubsonicLibrary ./dropbox_cli_selective_sync.sh }"
# TODO: avoid ls ---> http://mywiki.wooledge.org/ParsingLs
dropbox(){
/usr/local/bin/dropbox.py "$@"
}
pushd ~/Dropbox > /dev/null
while [ "$(ls -1 | grep -v $DROPBOX_FOLDER_TO_KEEP | wc -l)" -ne "0" ]
do
item=$(ls | grep -v "$DROPBOX_FOLDER_TO_KEEP" | head -1)
echo Excluding $item
dropbox exclude add "$item"
done
popd > /dev/null
dropbox exclude list
echo "Done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment