From: Ilmari Heikkinen Date: 2005-06-02T05:56:26+09:00 Subject: Re: Document identification ke, 2005-06-01 kello 23:33, Austin Ziegler kirjoitti: > On 6/1/05, Ilmari Heikkinen wrote: > > ke, 2005-06-01 kello 19:00, M. Eteum kirjoitti: > > > Dear Ruby Guru: > > > Is there a way to identify any documents from its header? I have a > > > bunch of document collected over the year from multi platform system, > > > Mac, Windows, and various unix/linux variant where some of the document > > > does not have file extension. Are there a list that tells us what header > > > should we expect for certain documents e.g. txt, rtf, pdf, jpg, mpg, > > > word, excel, visio, etc ... > > > > > > Thanks > > Most of this is covered by MIME::Types on RubyForge. However, the OP > indicated that the problem was related to NOT having proper filename > extensions. The OP wants to look for magic numbers and strings. > Shared-mime-info does this aswell. Though it may fare worse than file in some cases. kig@bauhaus:~$ mv fire.avi fire kig@bauhaus:~$ irb irb(main):001:0> require 'mime_info' => true irb(main):002:0> MimeInfo.get('fire') => Mimetype['video/x-msvideo']