Created
September 30, 2014 04:56
-
-
Save purpleidea/0ed86f735807759d455c 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
$ 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