I recently merged two databases by exporting each of them to my desktop and then importing them into a new database. I had created a web of replicants in each of the original databases, yet when I imported them into the new database the replicants had all become duplicates!
I’m using DEVONthink Pro. The new database is about 2.5 GBs and consists entirely of PDFs of nineteenth-century publications (about 3000 of them).
What should I have done to ensure that my network of replicants remained intact? I’ve searched the manual but have not come across this. Now I’m faced with the task of manually recreating all the replicants and deleting the duplicates.
If there is an answer to this question, I have no idea what it is. I too have an intricate web of replicants throughout my 67 million word database. When I had to re-import the lot a few months ago, I just had to re-replicate everything. It took weeks. I would love to know the answer if there is one.
There might be an AppleScript answer to this, provided that you have no legitimate duplicates, only replicants, but it’d probably be a damn slow script. I’m guessing that sounds better than doing it manually.
tell application "DEVONthink Pro"
set theDatabase to current database
set theDuplicates to every content of theDatabase whose number of duplicates is greater than 0 and type is not form
repeat with thisDuplicate in theDuplicates
if number of duplicates of thisDuplicate is greater than 0 then
set theDuplicatesDuplicates to the duplicates of thisDuplicate
repeat with thisDuplicatesDuplicate in theDuplicatesDuplicates
if number of duplicates of thisDuplicatesDuplicate is greater than 0 then
set thisLocation to (the location of thisDuplicatesDuplicate)
set thisLocation to get record at thisLocation
replicate record thisDuplicate to thisLocation
delete record thisDuplicatesDuplicate
Definitely back up your database before trying this. It should be safe, though. The “try” block is necessary because otherwise you’ll get an error trying to tell DEVONthink to do things with records you’ve already deleted. The thisLocation madness is necessary because, even after some badgering on this forum, no one wants to tell me how in the hell you find the parent group of a record in a format that you can replicate/move/create things in. It must be ridiculously simple, and yet I can’t figure it out. Also, DEVONthink could use a “exists record” command that checks if a record with a specified id exists, which would eliminate the need for the “try” block (edit: this does exist, but is in the standard suite so I didn’t notice it. My bad). Anyway, this lists all the duplicates, then goes through the list and makes sure each one is a duplicate before making a list of duplicates and going through that list, making sure that each is a duplicate before it replaces it with a replicant. So there’s some safety measures built in, and it shouldn’t screw anything up, but I’m an amateur so back up your database! There’s no undo.