Subj : Re: Determing file types To : comp.programming From : Jeremy Phelps Date : Wed Jul 13 2005 05:30 am On 2005-07-11, Matthias Kaeppler wrote: > Hello, > > I am currently developing a filemanager and I was wondering if anyone > has an idea how I could determine the type of a file in the GUI (e.g. > "PDF File", "Plain Text", ...). > > I have played around with gnome-vfsmm a little, and it has a function > for getting the MIME type of a file; but just displaying that > information is not very attractive. > Of course I could build a class which parses the MIME-string and builds > a more human readable filetype description, e.g. turn "audio/mpeg" into > "MP3 File". If you're on a Linux system, there is probably already such a database on the computer, given that file managers exist that say "PDF File" and not "application/x-pdf". The output of the following command just might contain the path on your Linux system to a text file that maps MIME types to more "friendly" descriptions (or it might turn up nothing): grep -ril 'plain text' /usr /etc 2>/dev/null | grep -i text/plain .