Comparing an indexed folder with imported folder -- in different databases?

Hi, I’m changing my approach to my file organization by replacing my imported files with indexed files. Almost all the files are in a single folder in Finder on the Mac – but some are only in DT. I now have one database with the indexed folder, and a different database with the similar set of files.

How do I find all the files that are in the imported database that are not in the folder on my hard drive that’s now indexed? Is there a way to compare the files in one database with those in another? Or is it better to move the indexed folder into the database with the imports so I can search for files that aren’t in the indexed folder? What’s the best way to find the files I need to move to my hard drive that only exist on DT?

Thanks!

Is the structure (e.g. group hierarchies) of both databases identical/similar? Or at least the names of the indexed/imported items comparable and unique?

They are mostly the same. The imported files include a few .webloc & .webarchive files as well as a few pdfs. There are thousands of files, so most are the same. The group hierarchies are mostly the same, but not completely. The names of the duplicated files are almost all identical.

If the names of the files are unique, then a script could check whether database B contains the items of database A.

I’m a novice with script. If you have any tips, that’d be great. Otherwise, I’ll figure it out somehow. Thanks for pointing me in the right direction!

A basic script would look like this:

property pDatabaseName1 : "Test1"
property pDatabaseName2 : "Test2"

tell application id "DNtp"
	set db1 to database named pDatabaseName1
	set db2 to database named pDatabaseName2
	set theNames1 to name of contents of db1
	
	repeat with theRecord in contents of db2
		if theNames1 does not contain (name of theRecord as string) then
			log message record theRecord info "Not in database " & pDatabaseName1
		end if
	end repeat
end tell
1 Like

This would have worked but, although the file names are almost all identical, the hierarchies are not. So! I moved the files into the database with the indexed folder and could easily make a smart group to show me what was still missing in Finder. I’ll work at getting better with Apple Script for the future! Thanks.

And just because it’s part of my job to make sure people are being safe with their data…
Make you you’ve read and understand the Help > Documentation > In & Out > Importing & Indexing section, especially the Indexing and the filesystem subsection.

:slight_smile: