"Dear Lina: I work in a divorce lawyer's office. He has a
program that processes legal documents and court filings.
Basically, he saves all email attachments he receives to a single
directory, then he has to run the processor program on all these
files at the end of the day. Unfortunately, this program is
proprietary...I thought it might be possible to write a script
for this program that first verifies the file type. What should I
"My goodness, dear! That sounds like a truly complicated system.
It's easy to verify the file type using the awk and file commands.
file is a command line utility that uses some basic heuristics to
determine the file type. Over the years, hundreds of different file
types have been added to a magic file that contains the heuristics.
Browse through the file man pages and /usr/share/misc/magic (or
/usr/share/magic on some distributions) to see if the type of file
you need is supported. Here is a snippet of a bash shell script
that will give you an idea of where to start..."
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.