Import indexed Files into DTPO

I need some help!

I have a large folder with a lot of files indexed and an Inbox-Folder, which is linked by a Folder Script indexing new file automatically

Is there a script importing indexed files into DTPO Database??

thanks
mj

Have you checked the Folder Action scripts on the disk image?

Mario, we use the term “group” rather than “folder” in DT Pro, and “document” rather than “file” in DT Pro.

Those terms help distinguish between the Finder and the database.

The difference in terms is also appropriate. Groups do differ from the behavior of folders, and documents differ from files. For example, DT Pro allows document behaviors that would not be permitted in the Finder, such as replication.

If you use File > Index in DT Pro you can select and Index into the database multiple selected folders and/or files.

There are also Folder Action scripts (see the Extras folder on the download disk image) that can be attached to a Finder folder so as to Import or Index any file(s) or folder(s) added to that Finder folder.

Does this answer your question?

Thanks Bill,

my question is a little bit different -
I got a lot of files already indexed in DTPO - but now i want to “convert” their status within DTPO from “indexed” to “imported” - with a simple click on a script - and transfer it to the DTPO internal file respository
Any idea ?

Here’s how I would do that:

Create a new folder in the Finder to receive exported material.

In DT Pro, bring the top-level view to the front, click on any group and select all.

Choose File > Export > Files & Folders and choose that new folder in the Finder to receive the export.

In DT Pro, create and name a new database. Now choose File > Import > Files & Folders and choose all of the content of that Finder folder.

Presto. Everything will now be copied into the database.

Remember, though, that Word .doc files (if you have any) will remain externally located in that Finder folder, so don’t delete them there if you need to edit or print the original Word documents.

Bill, here is a little script to explain what i´m thinking of

tell application "DEVONthink Pro"
	set added_items to selection of window 1
	
	if added_items is not {} then
		
		repeat with theItem in every item of added_items
			if kind of theItem is not "Group" then
				set theGroup to first item of parent of theItem
				set thePath to path of theItem
				
				if theItem is indexed then
					delete record theItem
					import thePath to theGroup
				end if
				
			end if
		end repeat
	end if
	
end tell

I´m not quite experienced in scripting DT - so improvements are very appreciated

mario

Here’s a script adding some error checking:


tell application "DEVONthink Pro"
	set theSelection to the selection
	repeat with theRecord in theSelection
		if type of theRecord is not group and theRecord is indexed then
			my convertIndexedRecord(theRecord)
		end if
	end repeat
end tell

on convertIndexedRecord(theRecord)
	local thePath, theParent, theImport
	try
		tell application "DEVONthink Pro"
			set thePath to path of theRecord
			if thePath is not "" then
				if exists parent 1 of theRecord then
					set theParent to parent 1 of theRecord
				else
					set theParent to missing value
				end if
				set theImport to import thePath to theParent
				if exists theImport then delete record theRecord
			end if
		end tell
	end try
end convertIndexedRecord

And another script converting all indexed contents of the current database:


tell application "DEVONthink Pro"
	set theRecords to contents of current database whose indexed is yes
	repeat with theRecord in the theRecords
		my convertIndexedRecord(theRecord)
	end repeat
end tell

on convertIndexedRecord(theRecord)
	local thePath, theParent, theImport
	try
		tell application "DEVONthink Pro"
			set thePath to path of theRecord
			if thePath is not "" then
				if exists parent 1 of theRecord then
					set theParent to parent 1 of theRecord
				else
					set theParent to missing value
				end if
				set theImport to import thePath to theParent
				if exists theImport then delete record theRecord
			end if
		end tell
	end try
end convertIndexedRecord

Hi i have a question on this topic, using DT3 beta 7.

Assume i have an indexed folder in DT. I have added a lot of tags and extra custom meta data on some of the files inside the the folder.

Since i often see sometimes unexpected duplicates of records popup inside the indexed folder in DT (some kind of un-sync with Finder folder i guess) i want to import record A (which is an indexed folder) to avoid spend time cleanup inside indexed folder in DT every now and then.

Is there a good way to “convert” my indexed folder A incl all existing files to a DT record (imported)? I would like to keep all custom meta data on the files (which is not visible in finder) which i have assigned them in DT.

The contextual menu command “Move into database” will move the indexed files/folders into the database and effectively convert them to imported ones.

1 Like

Ok great, thanks! :slight_smile: