The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

mimetype - determine file type

SYNOPSIS

mimetype [options] [-] files

DESCRIPTION

This script tries to determine the mime type of a file using the Shared MIME-info database. It is intended as a kind of file(1) work-alike, but uses mimetypes instead of descriptions.

If one symlinks the file command to mimetype it will behave a little more compatible, see --file-compat. Commandline options to specify alternative magic files are not implemented the same because of the conflicting data formats. Also the wording of the descriptions will differ.

OPTIONS

-b, --brief

Do not prepend filenames to output lines (brief mode).

-d, --describe

Print file descriptions instead of mime types, this is the default when using --file-compat.

-f namefile, --namefile=namefile

Read the names of the files to be examined from the file 'namefile' (one per line) before the argument list.

--file-compat

Make mimetype behave a little more file(1) compatible. This is turned on automaticly when you call mimetype by a link called 'file'.

A single '-' won't be considered a seperator between options and filenames anymore, but becomes identical to -s. ( You can still use '--' as seperator, but that is not backward compatible with the original file command. ) Also the default becomes to print descriptions instead of mimetypes.

-h, --help
-u, --usage

Print a help message and exits.

-i, --mimetype

Use mime types, opposite to --describe, this is the default when _not_ using --file-compat.

-L, --dereference

Follow symbolic links.

--language=language

The language attribute specifies a two letter language code, this makes descriptions being outputted in the specified language.

-N, --noalign

Do not align output fields.

--output-format

If you want an alternative output format, you can specify a format string containing the following escapes:

        %f for the filename
        %d description
        %m mime type

Alignment is not available when using this, you need to post-process the output to do that.

-s, --stdin

Determine type of content from STDIN.

-v, --version

Print the version of the program and exit.

ENVIRONMENT

See File::MimeInfo.

DIAGNOSTICS

If a file has an empty mimetype or an empty description, most probably the file doesn't exist and the given name doesn't match any globs. An empty description can also mean that there is no description available in the language you specified.

The program exits with a non-zero exit value if either the commandline arguments failed, a module it depends on wasn't found or the shared mime-info database wasn't accesable. See File::MimeInfo for more details on this last case.

TODO

Since File::MimeInfo currently only uses globs and doesn't do any real magic parsing, reading from stdin wasn't implemented yet.

BUGS

No known bugs, please mail the author if you find one.

AUTHOR

Jaap Karrssenberg <pardus@cpan.org>

COPYRIGHT

Copyright (c) 2003 Jaap G Karssenberg. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

SEE ALSO

file(1), update-mime-database(1), File::MimeInfo(3), http://www.freedesktop.org/software/shared-mime-info/