Last active
December 23, 2018 15:29
-
-
Save matthewcosgrove/48c4c4aaab0f171fae30a47c1694460b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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