Windows, like DOS before it, uses file extensions to identify file types. But what about a file with an inaccurate extension or no extension at all?
Inaccurate or missing extensions can occur if a file has been munged during a disk recovery or automated file-renaming process or through simple user error. Typically the only way to determine the file type for such a file is to open the file in a binary / hex editor and use one's best guess. This can be extremely time-consuming if you don't have any idea what you're looking for in the first place.
Fortunately, there are better ways to find out the file type without trial and error. Programmer Marco Pontello has written an extremely handy application, TrID, designed to simplify this process. TrID scans one or more files and attempts to match the file types against a database of binary signatures.
The results are returned in descending order of probability. For instance, it may say that a given file has a 70% chance of being a Word document and a 30% chance of being something else. This significantly narrows down the amount of trial and error you'd need to go through to open the document properly. If there's already a misleading extension on the file, such as .CHK, you can pass a command-line switch to have TrID add an extension that's the best guess for that file. The maximum number of matches per file can also be constrained with a command-line switch, which is handy if you're scanning thousands of files or more.
The program's file-identification database is in XML format and is continually updated (it currently has more than 2,800 file types), so the program itself and its signature database can be updated independent of each other. Users can scan files themselves and contribute signatures to the database as needed. (For the best results, scan as many different kinds of the same file as possible. This allows the pattern engine to determine what is common between different files of the same type.)
About the author: Serdar Yegulalp is editor of Windows Insight (formerly the Windows Power Users Newsletter), a blog site devoted to hints, tips, tricks and news for users and administrators of Windows NT, Windows 2000, Windows XP, Windows Server 2003 and Vista. He has more than 12 years of experience working with Windows, and contributes regularly to SearchWinComputing.com and other TechTarget sites.
This was first published in October 2007