Finding Duplicates

I’ve about 3000 pdf’s in my database, a bunch of which are duplicates. I can see that they’re dupes (blue font) but I can’t seem to find a simple way to delete them. Anyone have a good idea?

You could use this script and select the groups containing the duplicates:


-- Remove Duplicates.
-- Created by Christian Grunenberg on Thu Feb 02 2006.
-- Copyright (c) 2006. All rights reserved.

tell application "DEVONthink Pro"
	try
		set this_selection to the selection
		if this_selection is {} then error "Please select some contents or groups."
		my removeDuplicates(this_selection)
	on error error_message number error_number
		if the error_number is not -128 then
			try
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

on removeDuplicates(theseRecords)
	local this_record
	tell application "DEVONthink Pro"
		repeat with this_record in theseRecords
			if type of this_record is group then
				my removeDuplicates(children of this_record)
			else if number of duplicates of this_record > 0 then
				delete record this_record
			end if
		end repeat
	end tell
end removeDuplicates

Warning: This can’t be undone. In addition, save this script in the folder ~/Library/Application Support/DEVONthink Pro and execute it via the “Scripts” menu as this is much faster than executing it via Apple’s Script Editor.

Worked perfectly. I should check out the applescript dictionary before asking! Thanks Christian!