Created
April 14, 2015 07:40
-
-
Save farrrr/1ce07b2217f810091a1f to your computer and use it in GitHub Desktop.
Fix dropbox conflict version (use local version)
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
| #!/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="MacBook Air" | |
| #NAME='myhostname' | |
| DATE='2015-04-14' | |
| mkdir -p "$BACKUP" | |
| find . -path "* (與 * 衝突的複本 [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} 衝突的複本 ${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