FILE Command

Does Haiku have an equivalent to the file command? I am writing a script that needs to find out if the file I’m dealing with is plain text. In OSX (and Linux, I believe), I can do that with

file -b --mime-type filename

Any way to do this in Haiku?

Try this:

catattr -d BEOS:TYPE filename

If you’re not sure if the file in quesion has a MIME type assigned at that point, try a
mimeset filename
Though sometimes that sniffs out the filetype wrong. I just tried with a textfile containing a backtrace from a crash, and Haiku insists it’s a video/mp2t…

Regards,
Humdinger

http://ports-space.haiku-files.org/sys-apps/file-5.04-x86-gcc2-2010-05-17.zip

Extract it to /boot either with a GUI or using “unzip -d /boot file-5.04-x86-gcc2-2010-05-17.zip”

Thanks, everybody. Requiring my user to install file from Haikuports is not an option, unfortunately. I’ll see how far I can get with the suggestions you’ve made.