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 it possible to automate identification of the correct file type by analyzing the containing data?
file
command does this on *nix machines.windows
, but the comment imply: "You can't do that on Windows, you must use *nix instead". So? The comment is directed "for those interested". In what? Change computer?:(
file
is now a valid answer to this question (although I haven't tested it).