Created
March 19, 2019 09:32
-
-
Save Pamps/26818dd440b5df00b82f7ed745f3ec04 to your computer and use it in GitHub Desktop.
This file contains hidden or 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="Darren’s MacBook Pro 13" | |
#NAME='myhostname' | |
DATE='2015-06-18' | |
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 $'' -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" | |
echo "$file" | |
echo "$RESULT" | |
mv "$file" "$RESULT" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment