Is there an easy way to determine the type of a file without knowing the file's extension? Is there an easy way to determine the type of a file without knowing the file's extension? windows windows

Is there an easy way to determine the type of a file without knowing the file's extension?


you can use these tools to find the file format.

File Analyserhttp://www.softpedia.com/get/Programming/Other-Programming-Files/File-Analyzer.shtml

What Formathttp://www.jozy.nl/whatfmt.html

PE file format analyserhttp://peid.has.it/

This website may be helpful for you.http://mark0.net/onlinetrid.aspx

Note:i have included the download links to make sure that you are getting the right tool name and information.

please verify the source before you download them.

i have used a tool in the past i think it is File Analyser, which will tell you the closest match.

happy tooling.


This is not a complete answer, but a place to start would be a "magic numbers" library. This examines the first few bytes of a file to determine a "magic number", which is compared against a known list of them. This is (at least part) of how the file command on Linux systems works.


Someone else asked a similar question and posted the code used to do exactly this. You should be able to take what is posted here, and slightly modify it so that it pulls from your database.

https://stackoverflow.com/questions/58510

In addition to that, it looks like someone has written a library based off of magic numbers to do this, however, it looks like the site requires registration, and some form of alternate access in order to download this lirbary. The documentation is avaliable for free without registration, that may be helpful.

http://software.topcoder.com/catalog/c_component.jsp?comp=13249160&ver=2