I am consolidating hundreds of thousands of files into a dozen or so DT2 databases, and after years of backups and saving to multiple drives, there are tons of duplicates.
So let’s say I had imported previously the file “FOO” into a DT database, and that now I am about to bring a finder folder from a backup disk into the same database, and it happens to contain a copy of “FOO”.
I want to be able to know if “FOO” was already there - and DT is better than anything else to get rid of these, thanks to the very neat ability to color duplicates blue.
One provlem, though: If the newly imported folder has hundreds, if not thousands of blue files, then deleting them is a royal pain. But there is a better way. Use my script (at bottom)
BEFORE YOU PROCEED!
Make sure you know what you are doing. This script doesn’t offer any protection against mistakes. Use with caution.
Add all the FINDER folders you want to an “EXAMINE” folder inside the INBOX of your chosen DT2 database.
Don’t delete the finder folders yet.
In DT select each of the new folders under “EXAMINE” - and run the script.
It won’t take too long to delete every file that is blue. What remains theoretically had no duplicates in the database.
Double check the remaining files, and if you are confident of what resulted (I have been) now you can delete the original finder folders.
I triple check everything, because I found out that sometimes DT2 doesn’t color a file blue when it should (has been happening with some gifs, pngs - but not always). Still, when a DT2 file is blue, you can be sure it is a duplicate.
SCRIPT
tell application “DEVONthink Pro”
set theList to {}
set theDuplicates to {}
set theList to children of current group
repeat with y in theList
if (number of duplicates of y is not 0) then
delete record y
end if
end repeat
end tell
enjoy,
mike