How to recognize a file type, based on it structure?
CASTalk.com Forum Index CASTalk.com
Discussion of DSP, FPGA, storage and embedded system.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web castalk.com
How to recognize a file type, based on it structure?

 
Post new topic   Reply to topic    CASTalk.com Forum Index -> File System
Author Message
Eskimo
Guest





Posted: Tue Sep 21, 2004 12:33 am    Post subject: How to recognize a file type, based on it structure? Reply with quote

In Linux systems, we have a tool, called 'file" that can help to discover
wich structure the file have.
Example: file <filename> returns, the type, based on structure, MP3,
EXEcutable for MS-DOS, Video and so on. The success rate is very high.

There is a tol, for Windows, that can do it by command-line?

I've tried TRID32, and besides intersting features like "learning" with new
files, the app fails several times, in recognize file types. I've tested
with various video files (asf, avi, mpeg) made by several different decoders
and in many files, Trid32 was unable to recognize the file extension. The
same files analyzed by "file" command in Linux, were successfull reconized
as video files.

Someone can suggest another app?
I have to write Batch Scripts to recognize files based on strucure (not on
file extenions), search for videos, music, etc, and delete them all to claim
free space on the server (The users learned that if they rename MP3 files to
..DOC, my Scrpts can't detect them)
Back to top
Tim Slattery
Guest





Posted: Tue Sep 21, 2004 5:08 pm    Post subject: Re: How to recognize a file type, based on it structure? Reply with quote

"Eskimo" <eskmo@iglu.net> wrote:

Quote:
In Linux systems, we have a tool, called 'file" that can help to discover
wich structure the file have.
Example: file <filename> returns, the type, based on structure, MP3,
EXEcutable for MS-DOS, Video and so on. The success rate is very high.

There is a tol, for Windows, that can do it by command-line?

No.

Quote:
I have to write Batch Scripts to recognize files based on strucure (not on
file extenions), search for videos, music, etc, and delete them all to claim
free space on the server (The users learned that if they rename MP3 files to
.DOC, my Scrpts can't detect them)

AFAIK, this can't be done.

--
Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov
Back to top
Dan Lovinger [MSFT]
Guest





Posted: Wed Sep 22, 2004 1:27 am    Post subject: Re: How to recognize a file type, based on it structure? Reply with quote

In the elder days, UNIX tools used a file /etc/magic which, in spite of its
name, was nothing like magic. It simply had a list of leading byte sequences
along with the file types. I don't know what the current tools use, but it
must be the same thing in a different location (and possibly a little more
involved). Folks are usually very good about making this kind of test work
with their file formats ...

If you look at these files, I think you will quickly spot identifying byte
sequences at or near the beginning of them. It'll have about the same risk
of false positives too since it is using the same technique - caveat emptor.

--
Dan Lovinger
Microsoft Corporation
Please do not send e-mail directly to this alias. This alias is for
newsgroup purposes only.

"Tim Slattery" <Slattery_T@bls.gov> wrote in message
news:st90l052pr1n49tonarmo7qo9sfj49teo0@4ax.com...
Quote:
"Eskimo" <eskmo@iglu.net> wrote:

In Linux systems, we have a tool, called 'file" that can help to discover
wich structure the file have.
Example: file <filename> returns, the type, based on structure, MP3,
EXEcutable for MS-DOS, Video and so on. The success rate is very high.

There is a tol, for Windows, that can do it by command-line?

No.

I have to write Batch Scripts to recognize files based on strucure (not on
file extenions), search for videos, music, etc, and delete them all to
claim
free space on the server (The users learned that if they rename MP3 files
to
.DOC, my Scrpts can't detect them)

AFAIK, this can't be done.

--
Tim Slattery
MS MVP(DTS)
Slattery_T@bls.gov
Back to top
 
Post new topic   Reply to topic    CASTalk.com Forum Index -> File System All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




VoIP Electronics Powered by phpBB