Skip to content

Instantly share code, notes, and snippets.

@andyburke
Created September 17, 2015 20:24
Show Gist options
  • Save andyburke/ffbfefd2f80cd79f7cae to your computer and use it in GitHub Desktop.
Save andyburke/ffbfefd2f80cd79f7cae to your computer and use it in GitHub Desktop.
Auto exclude folders from dropbox
#!/bin/bash
# see: http://stackoverflow.com/questions/3685970/check-if-an-array-contains-a-value
elementIn () {
local e
for e in "${@:2}"; do [[ "$e" == "$1" ]] && return 0; done
return 1
}
if [ ! -f /data/dropbox/folder_list ]
then
exit;
fi
IFS=$'\n' read -d '' -r -a folder_list < /data/dropbox/folder_list
HOME=/data/dropbox
pushd /data/dropbox/Dropbox
for entry in ./*
do
FILE=$(basename "$entry")
if ! elementIn "$FILE" "${folder_list[@]}"
then
dropbox.py exclude add "$entry"
fi
done
popd
* * * * * dropbox /usr/local/bin/auto_exclude.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment