Finding broken file references in DT

I wonder if there’s an easy way to find file references in DT that are no longer valid. I dragged a bunch of files using Cmd-Opt into DT, then moved their location. DT could still find them, but here’s the twist…

I sync my desktop and laptop using Chronosync. Once synced, it appears that DT can no longer find the moved files. I suspect this is because Chronosync deletes the original files on the destination machine and re-creates (as NEW files on the destination machine) the ones that were moved on the source machine.

At least I think that’s what’s going on! Can’t think of another reason why this would happen.

So, it would be nice to find all these broken references, fix them, and then make sure I don’t move them in the future (or if I do, take steps to fix things up as soon as it happens, maybe by manually moving the archived originals to the new location on the destination machine).


Just run this script which logs all indexed contents referencing a non-existing file to the log (see Tools > Log):

tell application "DEVONthink Pro"
	set theItems to contents of current database whose indexed is yes
	repeat with theItem in theItems
		set thePath to path of theItem
		if thePath is not missing value and thePath is not "" then
				set theFile to thePath as POSIX file
				set theInfo to info for theFile
				if theInfo is missing value then error
			on error
				log message (name of theItem) as string
			end try
		end if
	end repeat
end tell

Thanks! There are a lot of “non-existent” files, but I’ve learned a valuable lesson fairly early on :slight_smile: