Dropbox is a great tool but if you use it on more than one computer, you are bound to find ‘conflicted copies’ eventually. A ‘conflicted copy’ is created when the same file is edited on two different computers at the same time, or close enough that Dropbox cannot tell which one is the newest.
The good news is that Dropbox creates these ‘conflicted copies’ instead of trying to guess which file is the one that you want. The bad news is that if you don’t notice that Dropbox has created a conflicted copy, you might start using the wrong file. Unfortunately Dropbox does not alert you when a conflicted copy is created, you have to search for it yourself.
Here is an example of a conflicted file: Settings (TJ Luoma’s conflicted copy 2013-01-09).textexpander As you can probably guess, the original filename is Settings.textexpander and Dropbox has added the words “conflicted copy” and the date in parentheses, as well as the username. (The username can be helpful if you find a conflict in a shared folder.)
Doing it is easy, remembering to do it is hard.
I’ve known that Dropbox creates these files for years, but do I ever remember to look for them? Nope. In fact, I don’t even try to remember to look for them. Instead, I have a shell script which does that for me.
The shell script runs every 5 minutes via launchd, and if it finds any conflicts, it alerts me using Growl and growlnotify. It uses a ‘sticky’ notification in Growl, which means that it will not go away until I click on it (but the notification also has a unique ID so only one notification will ever appear on-screen at any given time).
Download dropbox-launchd-conflicted-copy.sh to /usr/local/bin/ and make sure it’s executable (chmod 755 /usr/local/bin/dropbox-launchd-conflicted-copy.sh).
Move com.tjluoma.check-for-dropbox-conflicted-copies.plist to ~/Library/LaunchAgents/ and then either 1) run this line in Terminal:
launchctl load ~/Library/LaunchAgents/com.tjluoma.check-for-dropbox-conflicted-copies.plist
or 2) log out and back in.
How do you find the conflicts once you know that they exist?
There are two options that you can use once you are alerted that there are conflicts in your Dropbox. The first is Spotlight, the second is dropbox-launchd-conflicted-copy.sh.
Option A) Use Spotlight. Create a search which looks for filenames that match “‘s conflicted copy”. Actually, you don’t even have to make one, you can just download this one DropboxConflicted.savedSearch and move it to ~/Library/Saved Searches/. You might even want to add that to the Finder’s sidebar.
Note: Once the Saved Search is there, you can even use it with
mdfind in Terminal:
mdfind -s 'DropboxConflicted' -onlyin "$HOME/Dropbox"
Or, if you don’t have a saved search, you can use Spotlight on the command line like this:
mdfind -name "'s conflicted copy" -onlyin ~/Dropbox
Option B) Use
find. Call me an old crotchety Unix nerd (pause), but I still prefer the Unix
find command instead of Spotlight. Asking Spotlight to look for something is like asking my 10 year-old: if he comes back and says that he couldn’t find it, I always wonder how hard he really looked. On the other hand:
find ~/Dropbox/ -path "*(*'s conflicted copy [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]*" -print
always gives me reliable results, and it only takes a few seconds.
But wait, there’s more! The dropbox-launchd-conflicted-copy.sh script is “context aware.” When it runs via
launchd it gives you the Growl notification shown above, but if it on the command line, it will present you with a list of all of the conflicted files that it found. Just launch Terminal.app, type dropbox-launchd-conflicted-copy.sh and press enter. If you don’t have any conflicted files, it will say “No conflicts found” and you can rely on
launchd to keep an eye on it in the future.
Finding Dropbox ‘conflicted copy’ files automatically originally appeared on TUAW – The Unofficial Apple Weblog on Wed, 20 Feb 2013 08:00:00 EST. Please see our terms for use of feeds.