Is there a command line utility to which I can pass a filename, that will return applicable UTIs for that file?

For example:

hypothetical-uti-fetcher /Library/Desktop\ Pictures/Aqua\ Blue.jpg

might give me:

public.jpeg
public.image
public.data
link|improve this question

56% accept rate
feedback

1 Answer

up vote 5 down vote accepted

You can use the mdls command to find the UTI for a file. Just do the command mdls /Library/Desktop\ Pictures/Aqua\ Blue.jpg and it will give you a bunch of info, toward the top it will say something like kMDItemContentType = "public.plain-text". Hope this helps!

link|improve this answer
Excellent. Thanks. mdls -name kMDItemContentTypeTree /Library/Desktop\ Pictures/Aqua\ Blue.jpg is exactly what I wanted. – smokris Nov 10 '10 at 0:41
You're welcome, I'm glad this helped. – Wuffers Nov 10 '10 at 1:06
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.