How do I alter a file's "kind" attribute?

Hi,


I've been looking all over for an answer to this issue, including this forum and including calling apple technical support (who couldn't help because it wasn't a software issue), so I have had no luck. I really hope somebody here can help me!!


I have many files, each with the .dat extension. But the file "kinds" for these files are all different: textedit document, text, xcode etc This means that they are all treated differently by the system, and (importantly for me) quicklook. (They also indicate this by having different icons).


This has knockon effects with different software I use them with, and it's really slowing down my workflow.


I need a way to tell OSX "all files with the .dat extension have the file kind "text' " or something to that effect.


  • Checking in "Get Info" shows the files kind, but has no way to edit it.
  • I have tried changing the software used to open the files (in Get Info, apply as default etc) - so for example making all .dat files open in textedit - their 'kind' remains the same (whatever it was before I tried doing it).
  • I have tried opening the files in textedit (for example) and saving them again - their kind remains the same.
  • I have tried creating a new file in xcode with the .dat extension (it just says it is a textedit file).
  • I actually have no idea how I created the file with the 'text' file type now - this is the only one which is viewable in quicklook.


I have hundreds (literally) of these .dat files, I really need a way to use them with quicklook, ie I just need to change their kind to "text".


Any help would be much appreciated... I'm going round in circles here...


Many thanks!

Posted on Aug 6, 2011 7:23 AM

Reply
4 replies

Aug 6, 2011 7:59 AM in response to Jennynot

"Kind" is really a metadata tag, not an attribute.

You can see this in Terminal with mdls <filename>

For a PDF Document, you will see: kMDItemKind = "Portable Document Format (PDF)"


You'll need to look into metadata editors to see if there is any solution to your problem. (I had a similiar issue awhile back, and was never able to find a solution).


If you only need to use quicklook, see if the command line utility "qlmanage" can help. (for example, in Terminal qlmanage -p filename)


Look at the options with "qlmanage -h" (and also man qlmanage) . There is an option to "Force the content type used for the documents". If you can somehow get this to work in Terminal, then you can easily turn it into a Service with a Hotkey so that you can have a custom quilklook for your file.


Also, you might be better off asking this in the "Mac OS X Technologies" UNIX forum.


Tony

Aug 6, 2011 9:03 AM in response to Jennynot

As an addendum, the SetFile program in Developer Tools seems to be effective. Not quite there, as it changes type not kind... but I can see the files in quicklook.


Does anybody know how I can apply this comman to every .dat file in my file structure? I've navigated to the folder containing the 50+ sets of .dat files I'm using... they're all in seperate directories, however, and it would take me a long long time to navigate to each folder directly to run the


SetFile -t TEXT *.dat


command. Is there a way I can apply this not just to every file with the .dat extension in the directory, but in subdirectories also?


Many thanks

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How do I alter a file's "kind" attribute?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.