Smart group for duplicates

Is there a way to modify the included script “Find Similar contents” to create a smart group that includes duplicates from the entire database. I want to find and delete any large duplicate files in one action. Thanks.

Gabe

Although it should be basically possible to write such a script, it would be too slow for a smart group. But this code might be a starting point:


tell application "DEVONthink Pro"
	set theDuplicates to every content of current database whose number of duplicates is greater than 0
	if (count of theDuplicates) is greater than 0 then
		set theGroup to create record with {name:"Duplicates", type:group}
		repeat with theDuplicate in theDuplicates
			replicate record theDuplicate to theGroup
		end repeat
	end if
end tell

The script replicates every duplicate to a new group called “Duplicates”.

Hurray! Not sure that helps Gabe but it certainly helped me isolate an ancient problem. Forgive my writing about it here during this moment of inspiration instead of mailing a support request …

There’s long been a damaged URL item in one of my databases, with a bold blue font claiming to have 2 duplicates in the Show Info window. Running your script replicated that item to the Duplicates group but no other duplicates appear there, at long last confirming my “phantom duplicates” hunch.

I said “damaged” because of those phantom dups plus the URL string became the item’s creation/modification date/time – 03/27/04 17:00:53 – at some unknown point after that.

Database verifications have never noticed anything wrong with that item and I decided to keep it in case deleting it might cause trouble. I can send you a copy of the database (~300K) if you’re interested in examining it. Or, I’d be satisfied just deleting that goofy item if you think that’s safe to do.

Whenever I’ve tried rebuilding the database the before/after values in Database Properties differ too much to trust the rebuilt version. And running “Export > Listing…” from the Script Menu gets stuck (not at the same item each time) before completion so I can’t use its output for before/after comparisons. Let me know if you’d like the database to recreate those two specific issues if not for the phantom item.

Thanks!

Please send the database (stuffed or zipped) to cgrunenberg - at - devon-technologies.com. Although this seems to be caused by a minor & old error of the database, at least rebuilding should work.

I’ll send you the database as soon as I gather together a few more details. It’s been awhile since I last fussed with this so a few things need updating.