Re: File signatures??

max at hyre.net max at hyre.net
Fri Jun 30 14:06:42 EDT 2017


   Dear Matt:

> The problem is that the recovery operation (using
> Testdisk/Photorec) results in files and file fragments
> that may or may not be correctly identified by file
> extensions.

   It sounds like what you want is a magic number (file-format ID: https://en.wikipedia.org/wiki/File_format#Magic_number) for .gnucash files.  Looking at my file it appears that ``<gnc-v2'' starting at the 41st character in the file whould do it.  (I presumee the `2' in ``-v2'' is a version number, and could change at some future date, but for now that's not a problem.)

   It would be nice if the recovery program lets you add to the file-ID list, otherwise you're back to grep.  I hope that it recognizes gzipped files (possible GNUCash files, compressed), but if not you want to look for the first two characters = 0x1f 0x8b.  Of course, then you'll have to unzip them to see whether they're really what you want.  :-/

   Gurus:  Is this right?  For future-proofing, can we assume the magic number will always be in position 41?  Is there an actual, designated, magic number for GNUCash files somewhere?

   Hope this makes sense/helps...


       Best wishes,

           Max Hyre




More information about the gnucash-user mailing list