Move to external folder items from all databases

Hi,

It becomes tiresome to manually move each file created in indexed databases to its external folder. As I’m already using a script to update items in indexed folders of all databases, I’m wondering if there is also a script to batch move all items to their external folders at once.

Thanks.

You could define a smart group of files that are internal, highlight all, and choose to move to the external folders. I have one such smart group in each of my indexed databases to do this.

Unfortunately I’m not at my Mac so can’t indicate the rules used.

You could also create a script and attach it to your indexed groups, which will then trigger the script to move the internal documents in the group to the indexed Finder folder each time the group is selected.

on triggered(theRecord)
	try
		tell application id "DNtp"
			deconsolidate record theRecord
		end tell
	end try
end triggered

I have been using a smart folder, as @pvonk suggests. However, I would like to further automate the process.

I’m trying to adapt a contributed script. The code below seems to work, but knowing next to nothing about scripting, I’m wondering if it has errors that should be corrected. Thanks in advance.

-- Update indexed items of all databases
-- Created by Christian Grunenberg on Tue Mar 25 2014.
-- Copyright (c) 2014. All rights reserved.

-- Set to true if indexed items are not only located at the root of the database
property pAllRecords : false

set dScope to button returned of (display dialog "Move all records at all levels to external folders?" buttons {"Yes", "No", "Cancel"} default button 1 with title "Setting")
if dScope = "Yes" then set pAllRecords to true
if dScope = "No" then set pAllRecords to false

tell application id "DNtp"
	try
		set theDatabases to databases
		show progress indicator "Deconsolidating Items" steps (count of theDatabases)
		repeat with theDatabase in theDatabases
			step progress indicator (name of theDatabase as string)
			set theRecords to records of theDatabase -- Children of root
			repeat with theRecord in theRecords
				if pAllRecords or theRecord is indexed then
					deconsolidate record theRecord -- Updates children of theRecord too
				end if
			end repeat
		end repeat
		hide progress indicator
	on error error_message number error_number
		hide progress indicator
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

How?

Modifying the script above. By the way, I’ve just realised that it reads “All rights reserved”. Does this mean that I shouldn’t modify it but delete its posting here?