This tool exports documents from an ELO DMS archive by:
- Reading metadata from the MDB database using mdb-json
- Building folder hierarchy from folder objects
- Converting image files (TIF/JPG) to PDF
- Organizing exported files in ELO folder structure
-
Load all objects from database
- Uses:
mdb-json {database} objekte(outputs one JSON object per line) - Streams data line-by-line for memory efficiency
- Processes both folders (objtype < 255) and files (objtype > 254)
- Uses:
-
Build folder path lookup
- Process folders only (objtype < 255) where objstatus = 0 (active)
- For each folder, traverse
objparentchain to root - Creates lookup:
[objid] => "path/to/folder" - Folder names are sanitized
objshortvalues
-
Process file objects
- Filter files (objtype > 254 and < 9999) where objstatus = 0 (active, excluding root)
- For each file:
- Convert
objdoc(decimal) to hex filename (e.g., 3101 → "00000C1D") - Calculate folder:
(objdoc >> 10) << 2(divide by 256), convert to 6-char hex - Build file path:
Archivdata/DMS_1/UP{folder_hex}/{hexFilename}.* - Example: objdoc=3101 → folder=(3101>>10)<<2=12=00000C →
Archivdata/DMS_1/UP00000C/00000C1D.* - Use glob to find file with any extension
- Get folder path using
objparentfrom folder lookup - Convert supported formats (TIF, JPG, PNG, GIF) to PDF or copy unsupported files as-is
- Save as:
Export/<folder_path>/<sanitized_objshort>.<ext>
- Convert
- Path:
Archivdata/DMS.MDB - Access Method: mdb-json from MDBTools package (outputs line-delimited JSON)
Main table containing all ELO objects (folders and files)
Key Fields:
objid(int) - Unique object identifierobjtype(int) - Object type:< 255= Folder/Container> 254= File/Document
objshort(text) - Display name/title of objectobjparent(int) - Parent folder's objid (builds hierarchy)objstatus(int) - Status flag:1= Deleted (skip these)NULLor other = Active
objdoc(text) - Document file ID referenceobjidate(date) - Index/creation date
Other Fields: objflags, objsreg, objxdate, objkey, objkind, objpath, objinfo, objmask, objattach, objakey1, objakey2, objlkey1, objlkey2, objuser, objlock, objhistcount, objdesc, objchildcount, objdeldate, objsyncdateloc, objsyncdaterem, objvtrep, objacl, replset, objguid, objtstamp, objsdata, objsdesc
Stores additional metadata key-value pairs for objects (not used in basic export)
Fields:
parentid(int) - References objekte.objidokeyno(int) - Key number/indexokeyname(text) - Key name (e.g., "ELO_FNAME")okeydata(text) - Key valueokeysdata(text) - Additional data
Note: File extensions are determined via glob pattern matching, so objkeys is not required for basic export
Document version history (not used in basic export)
Fields: objectid, documentid, userid, createdate, histid, histcomment, histversion, docmd5, docguid, doctstamp, docflags, docstatus, docsignature
Files are stored in a two-level directory structure based on objdoc calculation:
Pattern: Archivdata/DMS_1/UP{folder_hex}/{filename}
Folder Calculation:
- Take objdoc value (decimal)
- Divide by 256 using:
(objdoc >> 10) << 2- Shift right 10 bits (divide by 1024)
- Shift left 2 bits (multiply by 4)
- Net effect: divide by 256
- Convert result to 6-character uppercase hex
- Prefix with "UP"
Example:
- objdoc: 3101 (decimal)
- Folder calculation: (3101 >> 10) << 2 = 3 << 2 = 12
- Folder hex: 00000C (6 chars)
- Folder name: UP00000C
- Filename: 00000C1D.TIF (objdoc 3101 in 8-char hex)
- Full path:
Archivdata/DMS_1/UP00000C/00000C1D.TIF
More Examples:
| objdoc | (objdoc>>10)<<2 | Folder Hex | Folder Name | Filename |
|---|---|---|---|---|
| 3101 | 12 | 00000C | UP00000C | 00000C1D |
| 18000 | 68 | 000044 | UP000044 | 00004650 |
| 115000 | 448 | 0001C0 | UP0001C0 | 0001C138 |
When exporting, filenames (from objshort) are sanitized:
- Replace
/with-(dash) - Remove invalid characters:
\ : * ? " < > | - Replace multiple spaces/underscores with single space
- Trim whitespace
- Limit length to 200 characters
- Default to "untitled" if empty
Database entries:
objekte:
objid=100, objtype=1, objshort="Invoices", objparent=1 (folder)
objid=200, objtype=1, objshort="2024", objparent=100 (folder)
objid=300, objtype=256, objshort="INV-001", objparent=200, objdoc="3101" (file)
Export result:
Export/Invoices/2024/INV-001.pdf
Process:
- Build folder path for objid=200: "Invoices/2024"
- File objid=300 has objparent=200, objdoc="3101"
- Get folder path from objparent=200: "Invoices/2024"
- Convert objdoc to hex: 3101 (decimal) → "00000C1D" (hex, 8 chars)
- Calculate folder: (3101 >> 10) << 2 = 12 → "00000C" (hex, 6 chars) → "UP00000C"
- Build file path:
Archivdata/DMS_1/UP00000C/00000C1D.* - Glob finds:
Archivdata/DMS_1/UP00000C/00000C1D.TIF - Convert TIF → PDF (or copy if unsupported format)
- Save as: "Export/Invoices/2024/INV-001.pdf"
objdoc to Hex Filename:
- objdoc is stored as decimal integer in database
- Convert to hexadecimal uppercase
- Pad with zeros to 8 characters
Examples:
| objdoc (decimal) | Hexadecimal | Padded Filename |
|---|---|---|
| 10 | A | 0000000A |
| 41 | 29 | 00000029 |
| 3101 | C1D | 00000C1D |
| 65535 | FFFF | 0000FFFF |