Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I sometimes get files from my clients that have the wrong file extension. For example, the name is image.jpg but the file is actually a TIFF image. In many cases I can clarify it by opening the file in a text editor, looking at the first few bytes, then deducing which file type it is.

This works for me with JPEG, TIFF, GIF and PDF files. However there are many more file types out there.

Is there a Windows tool that can identify the correct file type by analyzing the containing data?

share|improve this question

closed as off-topic by random Oct 24 at 14:47

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking product, service, or learning material recommendations are off-topic because they become outdated quickly and attract opinion-based answers. Instead, describe your situation and the specific problem you're trying to solve. Share your research. Here are a few suggestions on how to properly ask this type of question." – random
If this question can be reworded to fit the rules in the help center, please edit the question.

25  
For those interested the file command does this on *nix machines. –  boehj Apr 24 '11 at 12:37
1  
Very nice question! Something that I had secretly wanted all this time, but always forgot to ask :) –  pepoluan Apr 24 '11 at 13:54
    
I think linux distributions can detect file extensions –  user Apr 24 '11 at 17:11

4 Answers 4

up vote 79 down vote accepted

You can use the TrID tool which has a growing library of file type definitions for identifying files with.

Screenshot

Wildcards are supported, so in your example you could just put all the images to be examined in a folder, e.g. C:\verifyimages - then you can use the command:

trid C:\verifyimages\*

This will examine all files in the verifyimages folder.


There is also a GUI version available, TrIDNet:

Screenshot

There is documentation available on how you can you can easily integrate TrID or TrIDNet into Windows Explorer and Total Commander:

Windows Explorer

Total Commander

share|improve this answer
1  
Very nice! Thanks for the info! –  pepoluan Apr 24 '11 at 13:54
1  
Thanks, this is exactly what I was looking for! –  Martin Apr 26 '11 at 13:35

file

File tests each argument in an attempt to classify it. There are three sets of tests, performed in this order: filesystem tests, magic number tests, and language tests. The first test that succeeds causes the file type to be printed.

The type printed will usually contain one of the words text (the file contains only printing characters and a few common control characters and is probably safe to read on an ASCII terminal), executable (the file contains the result of compiling a program in a form understandable to some UNIX kernel or another), or data meaning anything else (data is usually “binary” or non-printable). Exceptions are well-known file formats (core files, tar archives) that are known to contain binary data.

share|improve this answer
1  
file is standard, but on older systems (especially non-Linux) not very knowledgeable. For Ubuntu etc it should be quite respectable and even installed as standard. –  Thorbjørn Ravn Andersen Apr 24 '11 at 13:28
    
I didn't think file existed on Windows installs at all (don't have a windows box to test with) –  Anm_LA Apr 24 '11 at 18:59
2  
I very much doubt that file is an expert on files made by Windows applications. –  Robin Green Apr 24 '11 at 20:23
4  
@Robin: You're welcome to test it. –  Ignacio Vazquez-Abrams Apr 24 '11 at 20:27
8  
@Robin: I very much doubt you've used file at all, and yet you've almost made up your mind about its effectiveness. –  tzot Apr 24 '11 at 23:24

I use Oracle's OutsideIn libraries in my programs. Not free, but they work well, especially for images. The market-speak says it supports over 500 file types.

share|improve this answer

I used to work for the French National Library, to build an digital archive system that contains not only digitized books but also millions of digital artefacts with all kinds of strange file types. We used JHOVE to recognize file formats.

JHOVE is open source, it is maintained by JSTOR and the Harvard University Library. It is rather simple to use.

share|improve this answer
    
cool! but does it recognize proprietary formats like TrID does? anyways, I do have some uses to identify subformats/variants of non-proprietary formats (or, to be precise, proprietary 'extensions' to standardized formats), so this would come in handy. thank you for the heads-up! –  pepoluan Apr 24 '11 at 14:00

Not the answer you're looking for? Browse other questions tagged or ask your own question.