I'm looking for a utility (either for Linux or Windows) which can verify that file contents seem to match the extension. This is for catching badly corrupted files.
I'm on the verge of writing a little bash script which will just run "file" on everything, but I don't want to figure out what "file" returns for a all of the properly-formatted file types that I'm going to encounter.
Background: A friend recently accidentally erased their Windows user folder (yup... Desktop, registry, My Docs, the whole thing...). I used an aggressive unerase utility to recover as much as I could. This particular utility recovers multiple copies of the same file for some reason (ie, "Letter.doc", "Letter(1).doc", "Letter(2).doc", etc...). Some of these files will contain random junk, some will be a valid document, and may of them will be the same document.
So, I've used fdupes and a perl script to nuke all of the duplicates, but now I want to separate the ones which look like they could be the original file from the ones which are probably not. I can't believe I'm the first person who's needed to do this...