LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-01-2011, 09:42 PM   #1
ewsmith
Member
 
Registered: Oct 2010
Location: Weesatche, Texas
Distribution: Slackware
Posts: 72

Rep: Reputation: 7
'file -bi' and custom mime types


i have created a custom mime type.
the mime type is based on the file name (one letter followed by four numbers and then one letter ie: a1234b)
file browsers (like thunar, rox-filer, and dolphin) recognize it, but 'file -bi' does not.

is there something i can do to rectify this?

SOLUTION:
my mimetype is based off the file name but 'file -bi' is based off the contents.
so 'file -bi' will not detect the file as the custom mimetype.

Last edited by ewsmith; 03-02-2011 at 08:10 PM. Reason: posting the solution for those who have a similar issue
 
Old 03-02-2011, 06:29 PM   #2
A.Thyssen
Member
 
Registered: May 2006
Location: Brisbane, Australia
Distribution: linux
Posts: 158

Rep: Reputation: 44
I can find no reference to -bi option for find.
And even trying to use it fails.
Code:
find -bi *
find: unknown predicate `-bi'
I assume you mean "file" not "find"


However taking a step back. The two while related, have very different meanings.

"file" determines what a file is based on its contents. It can use file suffixes, but generally tryes to ignore any such suffixes or other preconceptions about a file. Its results are generally nothing to to with a files "mime" type.

A files "mime-type" is simply a method of telling a client (recieving) program what type of file it is, which it then uses to determine how to handle (display, process, execute) the file. It does not actually need to match up with the actual contents of a file!

For example you have a file of plain ASCII numbers. "file" will tell you it is plain ASCII text, it may even tell you it only consists of numbers. But that is all. The "mime" type however can tell a client that it is just text (as "file" with indicate) 'plain/text', or just a save file, 'application/octectstream', or perhaps a image saves as ascii numbers 'image/x-rgbtext' It can be ANY of those things.

Really the two are very different things.


However you can make "file" recognise files by its content by adding rules to the file "magic" file. see the "file" manpage. It is not a simple file to edit, but it is possible to make "file" recognise the data in the file.

Last edited by A.Thyssen; 03-02-2011 at 06:33 PM.
 
Old 03-02-2011, 08:08 PM   #3
ewsmith
Member
 
Registered: Oct 2010
Location: Weesatche, Texas
Distribution: Slackware
Posts: 72

Original Poster
Rep: Reputation: 7
-facepalm-
yes, i meant file :\

i didn't know that it was based off the contents... thanks for the info

i'll look up this magic file.

EDIT:
fyi, im dyslexic when typing...

Last edited by ewsmith; 03-02-2011 at 08:09 PM.
 
Old 03-02-2011, 08:31 PM   #4
A.Thyssen
Member
 
Registered: May 2006
Location: Brisbane, Australia
Distribution: linux
Posts: 158

Rep: Reputation: 44
hey so am I..

Hmm on my linux system the magick was located in (via a symbolic link)
/usr/share/magic

The type: man magic
for information as it its format.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Google chome - can you create custom mime types? BrianK Linux - Software 1 05-14-2010 04:08 AM
.mime.types dive Slackware 3 01-18-2008 10:27 AM
cups, mime.types and mr.wobble Linux - Networking 2 05-29-2006 10:44 PM
mime types Nightfrost Linux - General 2 10-01-2004 05:11 AM
MIME Types? JoeLinux Linux - Software 6 09-14-2002 04:54 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 04:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration