Database splitting (export:reimport), replicants>duplicates

No, but DT will rebuild the replicants while importing the exported files and folders. BTW: The easiest way to split databases is probably to…

  1. create a copy of the database in the Finder
  2. open the first database and remove stuff which should be only part of the second database (and vice versa)

Are these instructions still relevant? (from 2005)
If so, how do I rename the second database? At the finder? Or close db1, open db2 rename db2, the open db1?

Just create a new database then move items from one to the other. If you have a large amount of data to move, it is best done in smaller batches than trying one massive move.

@BLUEFROG is that “move” as export and import? or drag from one database’s window to another? or something elese?

It’s “drag from one database’s window to another”. You could also use the contextual menu.

If it’s a large amount of data, it’s best to export files and folders then import them.

  1. Select the records to move in the source database.
  2. Choose File > Export > Files and Folders and choose (or create) a folder on your Desktop. This is important as it keeps any ungrouped files from being mixed in with other files accidentally.
  3. After the export is finished, switch to the destination database and choose File > Import > Files and Folders. Select the contents of the folder from Step 2, not the folder itself.

The caveat is you’d have a different Date Added in the destination database. If that’s important to you, I’d suggest you can drag and drop smaller batches between databases.

got it! Thanks for the quick reply!

You’re welcome :slight_smile:

continuing on this matter (what to do when your database grows to big), and more…

I’ve been thinking of rather than using a topic centric approach, I’m thinking of using a time-based approach.

To give action to this idea, I was thinking of creating a new database that acts as a shell to receive new data that has exactly the same tag and group names. So…

Is there a way to create a second, content-less database that has all the same tag and group names, but no content.

The operating parameter would for everything before X date go to first database, for everything after a certain date go to the second database.

In concept, the above works for me on the day-to-day use side.

but I’m unsure (have no idea) how to go about this.

Any thoughts how I might achieve this?

See Copy Folder/Directory Structure without files.

It should also be possible to create empty groups from selected tags with this script. If you move them into your new database’s tags group they’ll become tags.

thanks for the heads up. I’ll check it out.

Actually you can define a set of groups and export them as a template for reuse. This is also possible to do with a set of tags.

@BLUEFROG I like this idea. I’m unsure how to “define a set of groups”. I see the File » Export » As Template menu option, but I’m have trouble selecting the group and its subgroups. How does that work?

I’m missing something basic here[*1]…

When I use the File > Export > As Template pull down menu, I cannot get the As Template to become active—it remains grayed out. And remains so all the way down through the layers of groups and sub-groups until I reach an original document.

I was anticipating being able select a group with many SubGroups and make that a template.

So…

I have this extensive database[*2] with many clustered layers of Groups > SubGroups > SubSubGroups, and so on…

How do I make a template of the groups—and their nested SubGroups—and tags. So I can use the template as shell to feed more documents into? That way I can close my large database*

Thanks for you continued assistance while “catch on…”

*The Nitty-Gritty…
∞ 1. " Template: Saves the selected documents as a template, which can then be used to quickly create new documents using [Data > New from Template](file:///Applications/DEVONthink%203.app/Contents/Resources/DEVONthink.help/Contents/Resources/pgs/menus-data.html#new) . Export multiple documents and/or groups at once to create e.g.,a project template. Data & New from Template & Open Template Folder; can be used to organize templates."

∞ 2. 42…6 GG, 13,554 groups, 400 tags

@pete31 I’m working my way through the script on the other side of the link you posted. It looks promising, but…

But the script isn’t working for me. I think it may be do to how in my DT3 database my “groups” (folders icon) are now showing as “group tags” (icon of stacked tags).

Any 'next move(s) ideas?

I’ve now tested the script with different database properties. It’s working fine with all combinations of Exclude Groups from Tagging and Inherit Tags of Groups.

The script copies empty groups for selected records, so if you want to copy the whole Tags group you need to temporarily switch off

  • Preferences > General > Unify tags

and select the Tags group in your database.

Here’s what I get

1 - Select groups to copy

2 - Run script

-- Auth:	@cgrunenberg (2010)
-- URL:		https://discourse.devontechnologies.com/t/copy-data-base-structure/10468/2

tell application id "DNtp"
	try
		set theNum to my duplicateGroups(the selection, incoming group of current database, " copy")
		if theNum is 0 then error "Please select one or more groups."
	on error error_message number error_number
		if the error_number is not -128 then display alert "DEVONthink Pro" message error_message as warning
	end try
end tell

on duplicateGroups(theRecords, theDestination, theSuffix)
	local theRecord, theName, theCopy, theNum
	set theNum to 0
	tell application id "DNtp"
		repeat with theRecord in theRecords
			if type of theRecord is group then
				set theName to name of theRecord
				if theSuffix is not "" then set theName to theName & theSuffix
				set theCopy to create record with {name:theName, type:group} in theDestination
				set theNum to theNum + (my duplicateGroups(children of theRecord, theCopy, "")) + 1
			end if
		end repeat
	end tell
	return theNum
end duplicateGroups

3 - Result

Note: I expanded the incoming group’s content manually after the script finished.


If this doesn’t work for you please post a capture of File > Database Properties and of Preferences > General.

@cgrunenberg please take a look at this capture.

The record new post.webarchive was captured via service DEVONthink 3: New webarchive but it doesn’t have the correct URL (https://discourse.devontechnologies.com/t/database-splitting-export-reimport-replicants-duplican/1955/12).

Instead it got an URL that wasn’t open while capturing this record. Same happened yesterday but there the wrong URL was https://discourse.devontechnologies.com/latest which also wasn’t open while capturing.

In case of web archives the URL is actually retrieved from the contents of the file. Just send me the archive, thanks.

@pete31, @BLUEFROG @cgrunenberg Thank both!

@pete31 Your detailed guidance was instrumental. I missed:

  1. " Exclude Groups from Tagging and Inherit Tags of Groups ."
  2. " * Preferences > General > Unify tags" did the trick too!

Also, I found unchecking Preferences > General > Unify databases to be quite helpful.

Again thank you all for helping move my key database, it’s groups, tags and nested relationships forward in time.

1 Like