Can I view text files without a .txt extension in Quick Look?

In OSX, is there any way to treat files with unrecognized extensions as txt files, especially in Quick Look?

I am working with a lot of unix scripts that output files with uninformative extensions (e.g. file.1, file.2, file.3 etc.). I am a bit frustrated by the fact that OSX doesn't recognize these as the txt files they are. For instance, it would be very handy to look at them with Quick Look from Finder. Do you know whether there is any fairly straightforward way to do this?

Thanks.

Aluminum MacBook, Mac OS X (10.6.6)

Posted on Mar 1, 2011 7:54 AM

Reply
3 replies

Mar 9, 2011 3:10 AM in response to eplefrikk

Hi,

Well, I guess it depends how many different file extensions you're dealing with. I'm supposing that, if it's only a few (eg. 1., .2, .3, .4, .5) then you could simply Get Info on an example of each file, and tell the Finder to Always Open With... the text editor of your choice.

If, on the other hand, there're a huge variety of file extensions involved, you could try attaching a Folder Action script to the output folder, and tell it to scan for extensions of the type you're having problems with as they're created. Then, just tell the script to change those extensions to .txt. I'm afraid I don't know how to actually do that, but I know it's possible.

HTH,

S.

Mar 9, 2011 8:20 AM in response to eplefrikk

I think the files likely have to be "marked" as text files before Quick Look will display them that way. If it's OK to add a .txt extension to all the files (e.g. file.1.txt), I think there are utilities that will quickly do this batchwise. However if If you don't want to change the filenames at all, you can probably instead batch-add a "File Type" attribute, a hidden 4-character tag which Mac OS used to use as a primary method of determining a file's function. "File Type" codes are now obsolete, but apparently Snow Leopard (including Quick Look) will still use them if there is no recognizable file extension present.

I found an old free utility called [iLikeYouMore|http://ilikeyoumore.sourceforge.net] which can batch-add File Type codes and Creator codes (you don't need the latter) to files. If you open this app you get a little drop-window, and you can drag one or more files or an entire folder containing files to be modified onto that drop-window. For some reason I often had to drag a folder there twice for it to be accepted. Then type TEXT for the desired Type, leave the Creator field blank and the Creator checkbox unchecked, and click OK.
.
User uploaded file
.
When I tried this on a textfile that I had originally renamed with a .1 extension to make it unrecognizable, adding the TEXT File Type code again allowed Quick Look to display its contents.

Mar 9, 2011 9:23 AM in response to jsd2

Thank you so much for your replies!

I have actually already tried the solution you suggest about using the "Always Open With..." pane, SiRGadaBout. However, even when a file is set to open with a text editor, QuickLook will still not show it as a text file. But I'm sure attaching .txt extensions would do the trick.

iLikeYouMore looks like an elegant solution, though. I will definitely check that out!

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.

Can I view text files without a .txt extension in Quick Look?

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