How to explicitly set the file type aka kind

Using copy and paste I copied a bunch of extensionless files into DTPO. These are pure text (ASCII) files, but DTPO does not recognize them as such. After renaming them in DTPO, so they have a .txt extension does not make a difference. The “kind” (in shift-apple-I) is set to the file name.

Is there a way to reset this attribute to TXT ?

“Kind” is not accessible to users to change. DEVONthink responds to the file extension and other attributes to set “Kind”. Are you sure “Kind” is set to file name? Maybe post a sample Show Info screen snap for one of these? E.g.,

There may be a way to do this in DEVONthink, but * for indexed documents only I always reveal the document in the Finder and make the change there. As korm mentioned, DEVONthink does not allow the user to change the file Kind by changing the name of the document.

The Finder will change the file kind by changing the extension i.e. test.txt to test.md, the document becomes a Markdown document while attempting to change the extension in DEVONthink only changes the name i.e. test.txt becomes test.md.txt.

  • Edited to add this, as this only works with indexed documents. Changing the filetype in the Finder of documents imported into the database will cause problems.

Looked a little deeper. My background goes a long way into the Unix way of life :wink: So extentions are sooooo M$ :smiley:

Created a file called: test.me.now and imported it into DTPO. It contains ASCII text. Is of kind “now” Looking back my previous files had a very long part ofter the last dot, and a relatively short part before that dot. That’s why I was too fast stating “same as file name”

Looks like Kind translates to extension here. With the illfortune that changing the extension later does not effect the Kind.
I see the path also starts with “now”. Mmmm ok lets see how this continues.

Created a (text) file “test.me.later” and used Finder to move it into Inbox It appears in DTPO, and yes indeed its information show a path “later/2/test.me.later”
BTW if I do a “Show in Finder”, and in that Finder window change the filename so the extension becomes “txt” DTPO reports a File Missing error when I want to look at that file within DTPO.

The above “questionable” file extensions were generated by (bash) scripts. I collected these scripts and their output in DTPO. The output file their names is adequate for me to understand where they come from aka belong to. So I kind of dislike to put an extension to it (hee we have the command “file” to understand its type anyway :wink: )

But still the question remains: is it possible to reset that Kind attribute of metadata to txt (or whatever is needed) to make it reflect reality. Or is the only way to rename the file with proper extension in the Finder, and after that import it into DTPO?

Change file names and extension within the DEVONthink client. There’s a preference setting that will hide extensions, but even when that’s set you can still change name+client in the UI. Kind will update to reflect the extension, if neccesary. Most files with text content will be appear as Kind “text”, except things like markdown, html, etc.

Opening a DEVONthink database package to change file names or the database folder structure is not a great idea. Why do it?

Absolutely correct, and I should have been more specific in my earlier post (now edited). I do this with indexed documents, but should not be done with documents imported into the database.

Not sure if I understand your directions. Attached a screen shot of a test database. One group called MyGroup. Created a file “mg1” with the content “Hello”. Copied this one to mg2.later, mg3.now and mg4.txt.
Selected these four and dragged them into DTPO. What do I need to do to ensure Kind will have the value “Text” for the top three files (see image) too?

If this was me, I would rename (click, hold until Name is highlighted, edit):

mg2.later -->> mg2.txt or mg2.later.txt

Is there a reason to have “.later” extension?

Korn, thanks for the answer. I am used to double click the name, after which it becomes editable. However the Kind becomes the extension I now give it. Not “Text” as I hoped it would do. I would prefer Kind to reflect what it is, not what the extension happens to be.
And indeed when I originally imported the file “mg4.txt” DTPO kindly Kind-ed it with “Text” In that case it did a more intelligent attempt to guess the content type.

All extensions in this example have no meaning. It is just to show what happens to the Kind attribute. I still dislike the convention that extensions determine the type: I might have files with file names that are IP-addresses, in which I store additional information around that IP address. I doubt the final IP octet will be a well known extension :wink:

I do find the Kind attribute of much more importance, especially if I want to look at the file content: with later, now, or txt the buildin editor of DTPO does not open…
Extension should be used as a pointer to what to expect. And indeed for some it is meaningful. However turning it around that the extension is used to determine the Kind is one step too far. But alah, that’s another subject :wink:

So once more: is there a way to change the Kind attribute, besides by removing the file; changing its name in the Finder, and importing it again ?

No, with a possible exception. If the extensionless file could accept the command Data > Convert > to plain text, a new .txt file would be generated within the database, and the original file could then be deleted.

My practice is to avoid extensionless filenames, and to rename any such file with an appropriate filename including filetype extension outside of DEVONthink before Importing it to DEVONthink. Why fight OS X?

Edit: Note, though, that I don’t display filename extensions in document names. In DEVONthink’s Preferences > Import - Title I check the option “Filename without extension”. However, I usually include a column for Kind in database views.

Realizing none of our replies are deemed useful, so one final suggestion: use tags or comments instead. “Kind” is not going to behave the way you imagine it should.

The major reason for me pushing that Kind idea :wink: is that I came to believe this attribute determines if DTPO can (and how) open it. The text files in my examples are seen as a thing without type and therefor seem to be neither viewable nor editable from within DTPO directly

Even after I choose an external editor (TextWrangler) through the Open With menu command this needs to be repeated the second time. Looks like there are no memories here either.

Using script editor I see DTPO record has a property called “kind” which is read only. Guess this kind of confirms the read-only nature of it. Guess I need to be a bit more careful with extensions and reset my habits rooted in my unix background :wink: Pitty, since OSX is based on the same foundations …

Always loved the file command. This one indeed showed me what the file was, when I had the need to know :bulb:

Anyway, thanks for all the feedback!

Data > Open With… (and the same command in the contextual menu) uses OS X’s launchctrl database to determine what application opens a document. In otherwords, DEVONthink is not making this decision based on Kind – it is basing the decision on the same info configured either by the application that creates the document or the info configured by the user in Finder’s Get Info > Open With dialog.

Easy to test. Make a text file with an extension unknown by OS X. Say, “ASDF.BLAHBLAH”. Drag “ASDF.BLAHBLAH” into DEVONthink. Check “Open With” in Finder and in DEVONthink – same result – neither Finder nor DEVONthink know what to do and as the user to choose an app to open the document. Next, in Finder’s Get Info panel configure OS X to use TextEdit (or whatever) to open all documents with the BLAHBLAH extension. Immediately, DEVONthink knows that this is the configuration, which will appear in DEVONthink’s Open With menu.

The gist of this – use Finder’s Get Info to configure Open With document/application associates. DEVONthink doesn’t provide an independent service to do that.

(OS X’s launchd/launchctrl process that manages all this is not clean and error free, unfortunately. It makes configuration mistakes and it mis-associates file types and applications.)

Korn, thanks again. I wonder if I discovered a bug in Yosemite (10.10.1)…

Created a folder. In Terminal cd-ed into that folder, and did

a.kw
b.kw
c.kw

I now have three (empty) files with extension kw.

In a Finder window I do Apple-I on all three. As expected none of these have a default application set that is set for this extension.

Removed the three Info windows.

Select a.kw; Finder Apple-I, selected TextWrangel as application. Finder Apple-I on file b.kw: no application selected. Same for c.kw

Clicked away (red button, top left) all three info buttons. Checking again for all three. Indeed a.kw has a default app chosen, the other two have None.
Double clicked a.k, and TextWrangler starts with this file. Still the other two have None as their default app.

Trying again with extension ppp. Same story.

Perhaps the underlying reason for the above is the same for my not understanding DTPO.

Anyone else using Yosemite who can check the above? I do have regular strange issues since I upgraded to Yosemite

Did you click on the ‘Change All’ button to set TextWrangler to be the default app for all .kw documents? If not, then the expected behavior is what you just described.

This stopped happening many OSes ago when Apple started relying on UTIs instead of the resource/data fork model. (This conforms to the Windows model of mapping an extension to an application.)

If you create your own extension, there is no UTI registered for it. If there’s no registered UTI, there’s no known handler unless you specify one as korm and Greg suggest here. Even then it is a light association, meaning applications don’t have them registered as an Editor or Owner, etc. It is just a “Hey, open this file with this app.” Also, since there is no UTI, no QuickLook generator works with the files, hence no preview in Finder or DEVONthink.

Lastly, we can add support for new fileTypes, so we could add “.kw” as a plain text fileType but (1) this can’t be done on such an arbitrary basis, (2) would only clutter up our already extensive Preferences, (3) and would encourage a practice where portability of files would be greatly compromised (ie. you sending someone a .kw file would not work on their system).

It is always the best option to use one dot prefixing a valid/registered extension or let the system assign it (which it does, even if they’re not shown).