Find duplicates

A very useful feature in EagleFiler is the ability to filter duplicates during importing, and the option to prevent import of duplicates. I understand that there is nothing similar in DT. However, is there a way to search for ALL duplicate items in the database, and to then remove them manually? (I am aware of the “Find & Remove Similar Contents” option, but this works on a single entry at a time.)


The “Find & Remove Similar Contents” script supports both multiple selected items and groups (including their children). Or use the following script to remove all duplicates (except rows of sheets) with only one click:

-- Remove All Duplicates.
-- Created by Christian Grunenberg on Mon Jan 21 2008.
-- Copyright (c) 2008. All rights reserved.

tell application "DEVONthink Pro"
		if not (exists current database) then error "No database is open."
		set theDuplicates to every content of current database whose number of duplicates is greater than 0 and type is not form
		if (count of theDuplicates) is greater than 0 then
			display alert "DEVONthink Pro" message "Delete " & ((count of theDuplicates) as string) & " duplicates?" as warning buttons {"Cancel", "Delete"} default button 1
			if the button returned of the result is equal to "Delete" then
				repeat with thisDuplicate in theDuplicates
					-- Still a duplicate?
					if number of duplicates of thisDuplicate is greater than 0 then delete record thisDuplicate
				end repeat
			end if
			error "No duplicates found."
		end if
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell


Thanks much!

Christian, as much as I hate AppleScript Syntax, your script is absolutely elegant :wink:

However, would it be possible to do something different like removing duplicates and replacing them with aliases/replicates, unless they are in the same group/folder?

The script in this thread might be a starting point: