Skip to content

Instantly share code, notes, and snippets.

@mrtazz
Created February 20, 2010 15:12
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 mrtazz/309715 to your computer and use it in GitHub Desktop.
Save mrtazz/309715 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# Shell script to sync all content of the DropBox
# download folder to the OSX download folder
#
# Best used when attached to a folder action
#
SOURCE="/Users/mrtazz/DropBox/Downloads/"
DESTINATION="/Users/mrtazz/Downloads"
# rsync content from dropbox folder
rsync -r -z --exclude=".DS_Store" $SOURCE $DESTINATION
#!/bin/sh
#
# Shell script to sync all files smaller than the given size
# from the OSX download folder to the DropBox download folder.
#
# Best used with folder actions.
#
MAXSIZE=20000000 # max 20MB
SOURCE="/Users/mrtazz/Downloads"
DESTINATION="/Users/mrtazz/DropBox/Downloads"
IGNORELIST="/Users/mrtazz/bin/.dropbox_ignore"
# empty ignore list
touch $IGNORELIST
cat /dev/null > $IGNORELIST
echo ".DS_Store" >> $IGNORELIST
echo ".localized" >> $IGNORELIST
# parse files
find $SOURCE -maxdepth 1 | while read f
do
if [ -d "$f" ]
then
basename "$f" >> $IGNORELIST
else
filesize=`ls -l "$f" | awk '{print $5}'`
if [ $filesize -gt $MAXSIZE ]
then
basename "$f" >> $IGNORELIST
fi
fi
done
# rsync content to dropbox folder
rsync -r -z --exclude-from=$IGNORELIST --delete $SOURCE"/" $DESTINATION
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment