I tried searching for this but my Google has failed me. I have a directory full of files that are just their GUID:
b3445ffb-55f4-4538-bc6f-13534fd549f6
I know they can be only a handful of file extensions (doc,docx,pdf,jpg), but obviously the file extension does not exist. I could write a script that simply tries to open the file using all the known file extensions, but that wouldn’t be very efficient. Is there anyway to read the file and determine what the file should be?
OSX stores file type codes inside the file, and I was hoping that Windows stored similar metadata inside the file and the file extension was simply a historical artifact. Am I to be so lucky?
NB Since you might be wondering why I have a directory full of GUIDs, the database was suppose to keep track of the GUID and match it up with the filename and extension, but the table was dropped.
These are the file headers that should be on every valid file for that specific type.
JPEG
PDF
DOC
DOCX
For fun I wrote a little app in F# that matches the files. (Gotta love pattern matching!)