I succeeded to find the extended file type of a specified file ( JPEG image, TIFF Image, …) but I am looking for something more generic that can categorize files in “big cathegories” like images, moovies, text files, …
It there a way to acheive this in cocoa (or objective-c) ?
Thanks for your help,
You could use Uniform Type Identifiers. Since UTIs are organised into hierarchies, one possibility is to check whether the preferred UTI for a given file conforms to a top-level UTI, e.g.
public.imagefor images orpublic.moviefor movies. The Core Services framework includes functions that operate on UTIs as well as constants representing known UTIs.For instance, working on file name extensions:
If you have a MIME type instead of a file name extension, you can use
kUTTagClassMIMETypeinstead ofkUTTagClassFilenameExtension.For a list of known UTIs, see this document.