Skip to content

Instantly share code, notes, and snippets.

@willtonkin
Created January 13, 2014 10:14
Show Gist options
  • Save willtonkin/8397697 to your computer and use it in GitHub Desktop.
Save willtonkin/8397697 to your computer and use it in GitHub Desktop.
Something quick and nasty I used to fix a strange sync collision I had in Dropbox. The strings to change should be self explanatory. Tested in a Git repo I was working on so certain this works well.
#!/bin/bash
while IFS= read -r -d $'\0' file; do
dirname="${file%/*}/"
basename="${file:${#dirname}}"
removeme=" (Wills-MacBook-Pro's conflicted copy 2013-12-05)"
newname="${basename/$removeme/}"
mv -f "$file" "$dirname$newname"
done < <(find . -name "*conflicted\ copy\ 2013-12-05*" -type f -print0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment