How to differentiate .odt and .docx file apart from magic number and extension

450 views Asked by At

I need to detect the document type of the given file. I did it using magic numbers for pdf,RTF, doc files. but whenever I tried to do the same on odt and docx files, unfortunately, I can't because the magic number for both are same. Please help me to sort this issue. I need the answer programmatically in java Thanks in advance.

1

There are 1 answers

0
Gilles Quénot On

What I just tried now :

$ file file.docx
file.docx: Microsoft OOXML
$ file file.odt
file.odt: OpenDocument Text