Deduplicate
Finds duplicate files by hash, and duplicate emails by their content, across the whole collection or per custodian, and can copy out one copy of each document.
Deduplicate reads every file in the input and marks it Unique, Master or Duplicate. Files are duplicates when their hash is the same. The first file of each group in folder order (sorted as Windows Explorer sorts) is the master, so running it again on the same data gives the same result.
Emails are a special case: the same message exported twice, or from two mailboxes, often differs in its bytes. With emails-by-content on, .msg and .eml files are compared on their sender, recipients, subject, sent time, body text and the content of their attachments instead.
Use it when
- You want to know how much of a collection is duplicated before processing or review.
- You need one copy of each document for review or production, either across everything (global) or per custodian.
- The same emails have been saved by several people or in both
.msgand.emlform.
How to run it
- Choose the collection folder as Input. For custodian deduplication, make sure each custodian is a top-level folder under it.
- Choose an Output folder outside the input.
- Set Scope to Global or Custodian, and choose the Hash.
- Leave emails-by-content on unless you want emails compared byte for byte.
- Turn on copy-unique if you want the deduplicated set copied out.
- Click Run, then Open report and filter the Status column.
Settings
Every setting has the same help beside it in the app. On the command line, pass each as --name value; ltk help deduplicate lists them.
Settings
| Setting | What it does | Type and default |
|---|---|---|
Scope--scope |
Global: keep one copy across everything. Custodian: keep one copy per custodian (each top-level folder under the input is treated as a custodian). Custodian treats each first-level folder under the input as a custodian and keeps one copy per custodian, so the same file held by two custodians is Unique (or Master) in both. Files sitting directly in the input folder are grouped under the custodian (input root). |
choice: Global, CustodianGlobal |
Hash--hash |
Hash used to decide that two files have identical content. SHA-256 is the default. Choose MD5 or SHA-1 if you need the Key column to line up with hashes from another system. |
choice: MD5, SHA1, SHA256SHA256 |
Emails by content--emails-by-content |
Treat emails (.msg/.eml) as duplicates when sender, recipients, subject, sent time, body and attachments match — catches the same email saved twice or in different formats. Two emails match only if sender, all recipients (To, Cc and Bcc), subject, sent time to the second, body text (spacing ignored) and the content of every attachment are the same. Emails that differ only in an attachment are not duplicates. An email that cannot be read, or has no sender, subject or sent time, is compared by hash instead. The MatchedBy column shows which method was used. |
yes/notrue |
Copy unique--copy-unique |
Also copy one file per duplicate group (the master) plus all unique files into the run folder, hash-verified. Copies every Unique file and every Master into the run's files folder, keeping the folder structure and modified and created times, with a hash check on each copy. Duplicates are not copied and have a blank Destination. |
yes/nofalse |
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 deduplicate.csv, errors.csv and manifest.json (see Run folders and manifests).
deduplicate.csv: One row per file: Custodian, Status (Unique, Master or Duplicate), GroupId (D000001 and up, numbered in folder order), GroupSize, MasterPath (for duplicates), MatchedBy, Key (the hash or email fingerprint) and Destination if copied.files\…: Only with copy-unique: one copy of each document, in the original folder structure.
Report columns
RelativePathFileNameCustodianSizeBytesStatusGroupIdGroupSizeMasterPathMatchedByKeyDestinationFullPath
Check the result
- Read the notes: they give the number of files, how many to keep, the number of duplicates and groups, and the size of the duplicates in MB.
- Filter Status = Duplicate and spot-check a few against their MasterPath.
- Check MatchedBy on emails to see whether they were matched by content or by hash.
- With copy-unique, look at
errors.csvfor any file that could not be copied.
- Because the first file in folder order becomes the master, name or arrange folders so the copy you prefer to keep sorts first.
- Run with copy-unique off first to size the duplication, then run again with it on.
- Deduplicate never deletes or moves anything in the input. For a deduplicated set, use copy-unique.
- Content matching for emails is deliberately strict. Two copies of an email that differ in any recipient, the body text or an attachment stay separate.
From the command line
The command line is part of LitTechKit Pro. See Command line.
ltk run deduplicate --input "D:\Matter\Collection" --output "D:\Matter\Out" --scope Custodian --hash SHA256 --copy-unique true
Related tools
- File Inventory: Lists every file with size, timestamps, attributes, hashes and detected file type, flagging extensions that don't match the content.
- Extract Archives: Extracts ZIP, 7z, RAR, TAR and GZ archives (including archives inside archives) into a new folder, with hash verification, original modified times and protection against damaged or malicious archives.
- Near Duplicates: Finds exact and near-duplicate documents in a text export (one .txt per document, named by document ID). Endorsed stamps are removed first, so the same document produced twice with different numbers still matches. Each near-duplicate group has a pivot (its longest document) and every member's similarity to it.
- Copy Files: Copies all files, or those matching a list of names or hashes, into a new folder with hash verification, preserved timestamps and a not-found report.