Extract Attachments
Saves the attachments and attached emails of .msg and .eml files into a new folder, with family IDs that tie each attachment to its parent email and verified hashes for every file.
Extract Attachments opens each email, writes out every attachment, and records it in a report with a family ID. The emails themselves are read only and never changed.
Each email gets a family number in folder order (F000001, F000002 …). Its attachments are numbered under it (F000001.0001, F000001.0002), and the attachments of an attached email go one level deeper (F000001.0002.0001). Because numbers and folders are fixed in folder order, running the tool again on the same emails gives the same IDs and names.
Attached emails are always saved as .msg or .eml files, named after their subject. Unsafe or over-long file names are made safe before saving. Every file is hashed and re-read after writing to confirm the copy. As with the other email tools, emails saved with no extension (Unix mail stores such as the Enron corpus) are also read when Extensions is left empty.
Use it when
- You need the attachments of a set of emails as separate files for review, conversion or searching.
- You need to show which attachment came from which email (family relationships).
- You have extracted a mailbox with Extract Mailbox (PST/OST): its
.emlfiles keep their attachments inside, and this tool takes them out.
How to run it
- Choose the folder of emails as Input and an Output folder outside it.
- Choose the Layout: PerEmailFolder (one folder per email) or Flat (everything in one folder).
- Decide whether to tick Include inline for signature logos and embedded images.
- Set Minimum size (KB) if you want to skip small files, and leave Attachments of attached emails on to go into attached emails.
- Choose the Hashes to record.
- Click Run, then Open report and read the notes in the result panel.
Settings
Every setting has the same help beside it in the app. On the command line, pass each as --name value; ltk help extract-attachments lists them.
Settings
| Setting | What it does | Type and default |
|---|---|---|
Layout--layout |
PerEmailFolder: one folder per email (named after the email file), mirroring the source structure. Flat: all attachments in one folder, named <email>_<attachment>. PerEmailFolder mirrors the source folders and creates a folder per email, named after the email file including its extension (so x.msg and x.eml never share a folder). Attachments of an attached email go in a sub-folder named after that attached email. Flat puts everything in one folder named <email>_<attachment>; clashing names are numbered, never overwritten. Flat runs one email at a time so the numbering stays the same between runs. |
choice: PerEmailFolder, FlatPerEmailFolder |
Include inline--include-inline |
Also extract inline items (signature logos, embedded images in the message body). Off by default, so signature logos and images embedded in the message body are skipped and counted in a note. Turn it on when the embedded images matter, for example screenshots pasted into the body. Inline items are marked Inline in the Kind column. |
yes/nofalse |
Minimum size (KB)--min-size-kb |
Skip attachments smaller than this many KB (e.g. 10 to skip tiny images). 0 extracts everything. A quick way to drop tiny images. It applies to file attachments only: attached emails are always saved, and the filter also applies to files inside them. Skipped files are counted in a note but get no row. |
number0 |
Attachments of attached emails--nested |
Also extract the attachments of attached emails (up to 10 levels deep). Attached emails themselves are always saved as .msg/.eml files. On: the tool also opens attached emails and extracts their attachments, up to 10 levels deep. Off: attached emails are still saved as files, but their contents are not extracted separately. |
yes/notrue |
Hashes--hashes |
Hashes to record for each extracted file. Every file is verified after writing. Choose the hashes your matter uses. Whatever you pick, every file is verified after it is written; the Verification column says which hashes were checked. |
choices: MD5, SHA1, SHA256MD5,SHA1 |
Common settings
| Setting | What it does | Type and default |
|---|---|---|
Input required--input |
Folder (or single file) to read. It is opened read-only and never modified. | folder empty |
Output required--output |
Folder for reports. Must not be inside the input folder. Each run gets its own sub-folder. | folder empty |
Recurse--recurse |
Include sub-folders. | yes/notrue |
Extensions--extensions |
Only process these extensions (e.g. .pdf, .docx). Empty means the tool's default set. | list empty |
Parallelism--parallelism |
Files processed at once. Use 1-2 for spinning disks or network shares. | number4 |
What you get
Each run creates its own folder inside the output folder, with the report extract-attachments.csv, errors.csv and manifest.json (see Run folders and manifests).
files\…: The extracted attachments and attached emails, laid out as chosen in Layout.extract-attachments.csv: One row per attachment. FamilyId is the email's family; AttachmentId and ParentId give the tree; Level is 1 for a direct attachment, 2 for one inside an attached email, and so on. Kind is File, Inline, Email, No data or Error. Destination is the saved file, with its hashes and Verification.errors.csv: Emails that could not be opened and attachments that could not be written, with the reason.
Report columns
EmailPathFamilyIdAttachmentIdParentIdLevelAttachmentNameKindSizeBytesDestinationMD5SHA1SHA256VerificationEmailFullPath
Check the result
- Read the notes: they say how many emails had attachments, how many had none, and how many items were skipped as inline or too small.
- Filter Kind for Error (failed to extract) and No data (links or embedded objects with no file content; nothing was written for these).
- Check
errors.csvfor emails that could not be opened at all; the rest of the run carries on.
- An email with no attachments still takes a family number, so FamilyId values in the report can skip numbers. This keeps IDs stable between runs.
- Outlook contact photos are not extracted.
- The original attachment name is kept in AttachmentName even when the saved file name had to be made safe.
- Family IDs are this tool's own numbering, based on folder order. If you need production numbers, apply them later with Assign Document IDs or Bates Stamp.
- If you change the input folder (add, remove or rename emails) and run again, family numbers after the change will shift.
From the command line
The command line is part of LitTechKit Pro. See Command line.
ltk run extract-attachments --input "D:\Matter\Emails" --output "D:\Matter\Attachments" --layout PerEmailFolder --min-size-kb 10 --hashes MD5,SHA1
Related tools
- Extract Mailbox (PST/OST): Extracts every email and other item from Outlook .pst and .ost files into .eml files in the mailbox's folder structure, without Outlook. Optional date range, folder and item-type filters; every item is reported and folder counts are checked.
- Email Metadata: Reads subject, sender, recipients, sent/received dates, Message-ID and attachment names from .msg and .eml files.
- Convert To PDF: Converts Word, Excel, PowerPoint, RTF, text, email (.eml, .msg) and image files (including multi-page TIFFs) to PDF using the Microsoft Office on this PC, from read-only working copies with macros and external links disabled, keeping saved values and showing hidden content, and reports the page count of each PDF. AutoCAD drawings (.dwg, .dxf, R14 and later) are converted without AutoCAD, one page per layout.
- Deduplicate: Finds duplicate files by hash (and duplicate emails by their content), globally or per custodian. Reports every file as Unique, Master or Duplicate, and can copy out one copy of each.