Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1048347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T16:26:30+00:00 2026-05-16T16:26:30+00:00

I tried searching for this but my Google has failed me. I have a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T16:26:31+00:00Added an answer on May 16, 2026 at 4:26 pm

    These are the file headers that should be on every valid file for that specific type.

    JPEG

    0xFF 
    0xD8 
    

    PDF

    0x25
    0x50
    0x44
    0x46
    

    DOC

    0xD0 
    0xCF 
    0x11 
    0xE0 
    0xA1 
    0xB1 
    0x1A 
    0xE1
    

    DOCX

    0x50 
    0x4B 
    0x03 
    0x04
    

    For fun I wrote a little app in F# that matches the files. (Gotta love pattern matching!)

    module Program =
    
        let main () =
    
            let files = 
                seq {
                    for path in System.IO.Directory.GetFiles(directory) do
                        use fs = System.IO.File.OpenRead(path)
                        let buffer = Array.zeroCreate 8
                        let read = fs.Read(buffer, 0, 8)
                        match buffer with
                        | [| 0xFFuy; 0xD8uy; _; _; _; _; _; _; |] -> 
                            yield (path, ".jpg")
                        | [| 0x25uy; 0x50uy; 0x44uy; 0x46uy; _; _; _; _; |] -> 
                            yield (path, ".pdf")
                        | [| 0x50uy; 0x4Buy; 0x03uy; 0x04uy; _; _; _; _; |] -> 
                            yield (path, ".docx")
                        | [| 0xD0uy; 0xCFuy; 0x11uy; 0xE0uy; 0xA1uy; 0xB1uy; 0x1Auy; 0xE1uy; |] -> 
                            yield (path, ".doc")
                        | _ -> 
                            yield (path, ".unk")
                }
                |> Seq.toArray
    
            System.Console.ReadKey true |> ignore
    
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Tried searching for this but my google-fu is lacking today. So I have 2
I tried searching for this but couldn't find a similar question. I have a
I have tried searching over the internet about this problem but not able to
Ok, I have tried searching around for this answer, but with no luck. I
I've tried searching through search engines,MSDN,etc. but can't anything. Sorry if this has been
I've tried searching this on Google and here but nothing like the issue I'm
I tried searching in google but it just shows what I'm not looking for.
I've tried searching for this but it's pretty difficult to put into words. Basically,
I tried searching for information on this, but must not know the right terms
Sorry if this question is answered somewhere else but I tried searching several pages

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.