Force the Finder to show text file previews

May 12, '03 09:47:00AM

Contributed by: mundie1010

This is one of those "it's so obvious I can't believe I've been using OS X for two years without figuring it out" hints.

It's always frustrated me that the Finder wouldn't show previews of XML, CSS, XSL, or any other text files without a ".txt" suffix. I always assumed there was a table someplace that mapped file extensions to a "preview as text" property, but I had no idea where the table was.

I still don't know whether that table exists or how to modify it, but I've found another method that works: simply set the Finder info type field to TEXT. A simple

  find . -name *.xml -exec SetFile -t TEXT {} ;
is all it takes for XML files (within the current directory tree) to be previewable, assuming the Developer Tools are installed (SetFile is included with the Dev Tools).

D'oh!

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030510093445143