Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
$ cat fix-dropbox.sh
#!/bin/bash
# XXX: use at your own risk - do not run without understanding this first!
exit 1
# safety directory
BACKUP='/tmp/fix-dropbox/'
# TODO: detect or pick manually...
NAME=`hostname`
#NAME='myhostname'
DATE='2014-09-29'
mkdir -p "$BACKUP"
find . -path "*(*'s conflicted copy [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]*" -print0 | while read -d $'\0' -r file; do
printf 'Found: %s\n' "$file"
# TODO: detect or pick manually...
#NAME='XXX'
#DATE='2014-09-29'
STRING=" (${NAME}'s conflicted copy ${DATE})"
#echo $STRING
RESULT=`echo "$file" | sed "s/$STRING//"`
#echo $RESULT
SAVE="$BACKUP"`dirname "$RESULT"`
#echo $SAVE
mkdir -p "$SAVE"
cp "$RESULT" "$SAVE"
mv "$file" "$RESULT"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment