Created
September 17, 2015 20:24
-
-
Save andyburke/ffbfefd2f80cd79f7cae to your computer and use it in GitHub Desktop.
Auto exclude folders from dropbox
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
#!/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 |
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
* * * * * 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