How I Deduplicated 64,941 Font Files into a 33,365-Font Library
The Folder Was Not Short of Categories
The design team’s font share was 130 GB across 21,714 files. Of those, 15,692 were font files: 12,505 TTF, 2,794 OTF, 141 TTC, 206 FON, and 46 WOFF/WOFF2. The rest included 594 archives at 90.7 GB, 4,113 JPG previews, 442 PSD files and 501 PDF specimens. The NAS volume was 96% full. I treated the share as a production asset: the goal was a library the team could search, not a prettier folder tree.
The request was not “make a folder for every style”. It was narrower and harder: find a handwritten Traditional Chinese face, a cute Simplified Chinese face, or a classic English serif without opening fifteen directories first. The existing classification did not answer that. Of 6,004 rows in the old index, 2,950 were labelled “other” or “creative other” — 49% of the sample — and the sample covered only part of the library.
I scanned the tree from the NAS over SSH, then checked the old index. The scan showed why renaming folders would not be enough:
- Two packages were complete duplicates: 367 identical files (2.7 GB) and 136 identical files (1.4 GB).
- 2,709 files shared a name with another file; 4,172 shared a size. A conservative estimate put 10–15 GB of easy recovery in plain duplicates alone.
- Only 744 files across 406 families had genuine Traditional Chinese glyph coverage. Another 938 could display Traditional characters but used Simplified glyph shapes. 3,626 were missing Traditional characters, used an old Big5 encoding, or had no usable Unicode coverage.
That last point changed the shape of the project. “Handwritten Traditional Chinese” is not a folder rename; it is a 100–200 family curation problem. The full library could be indexed automatically, but the short list had to be chosen.
The Plan: Three Layers and One Index
I used a three-layer structure because a folder tree can express one dimension at a time: language, style, licence, or source. The questions the team actually asks combine several dimensions. The three layers handled that without moving every file:
- A curated library. 280 fonts, grouped by language and style, named consistently, and installed on the workstations. This is the “open and use” layer.
- The full library. Every unique font, grouped first by script
(
Traditional Chinese,Simplified Chinese,Latin,Japanese/Korean,symbols) and then by style (handwritten,serif,sans,display,monospace,calligraphic). - An index. A generated HTML gallery and a CSV/SQLite table that can filter across language, style, licence clue and source. The index answers “handwritten + Traditional + commercially usable” without requiring a folder for every combination.
I kept the original archives in a separate 06_原始包 directory as licence
evidence. Preview images, PSDs and tutorials moved to 99_素材资源. A _整理日志
directory held the scripts, CSV lists and the SQLite database.
Btrfs hard links made the dual-language problem cheaper. A font that
supports both Simplified and Traditional can appear under 01_中文_繁体/手写 and
02_中文_简体/手写 as two directory entries pointing at one inode. The file is
visible twice and stored once. Deleting one path does not delete the other.
Unpacking 594 Archives
DSM did not have unzip, so I used 7z. The zip files also carried Chinese
filenames encoded as GBK, which 7z reads correctly with -mcp=936. Some
files named .zip were actually RAR. The unpack pass therefore used both
tools:
7z x -mcp=936 "$archive" -o"$staging"
unrar x -o+ "$archive" "$staging/"
I started with 594 outer archives: 485 zip, 108 rar and one 7z. The pass unpacked 592 of them and opened 108 nested archives (13.1 GB) inside the output. The 142 archives in the second pass were nested packages found inside that tree, not leftovers from the 594 outer set. Two special cases mattered:
10000fonts.zipfirst failed on a name collision, then unpacked to 10,577 font files on retry.cad字体包.rarunpacked to 2,456.shxCAD fonts. Those are technical assets, not typography, and went to the symbol bucket rather than the Chinese library.
One 1 GB RAR failed its checksum and was deleted after the second pass confirmed the corruption. The main unpack added a full second copy of the font data. With the original 130 GB tree still present, plus retry output and conflict copies, the share peaked at 302 GB. That is the uncomfortable middle of the project: the original 130 GB was still there, the unpacked copy was new, and the volume had started at 96% used.
Deduplication: Size First, MD5 Second
I hashed only within same-size groups. Hashing 64,941 paths blindly would have been slow and unnecessary: files with a unique size cannot be byte-identical to anything else, so they skipped the hash entirely.
The numbers after the first pass:
| Stage | Result |
|---|---|
| Font paths before dedupe | 64,941 paths / 186.4 GB |
| Duplicate groups confirmed by MD5 | 12,784 |
| Duplicate paths removed | 32,095 |
| Unique fonts left | 32,846 |
The quarantine also held hard-link aliases, so counting directory entries would overstate the move. The unique-path count is 32,095: 64,941 minus 32,095 leaves 32,846. The CSV recorded every removal, and I deleted nothing until the list had been reviewed.
I set the keep priority deliberately: _可商用字体 first, then the original
directory, then the unpacked staging copy. The commercial package kept its
1,762 files untouched. The Traditional Chinese zips produced 1,412 unique
fonts after their own internal duplicates were merged.
After the first cleanup, the share was 147 GB. The 142 nested archives still
held another 44.7 GB. I unpacked 141 of them, found 35,917 duplicate fonts
by MD5, and imported 519 new ones. The first-pass 32,846 plus 519 is 33,365;
I left 27 archives in 06_原始包 as licence evidence. The final library was
33,365 fonts in 129 GB, with 2.0 TB free on the volume.
The Final Layout
00_精选库 280 fonts, installed on workstations
00_索引 index.html · 全库.html · fonts_index.csv
01_中文_繁体 3,837 entries (includes hard links)
02_中文_简体 5,094
03_英文西文 22,556
04_日韩 2,173
05_符号特殊 1,790
06_原始包 27 archives / 25.6 GB, kept as licence evidence
99_素材资源 previews, PSDs, PDFs and tutorials
_整理日志 scripts, SQLite database and CSV manifests
The style directories are the part a person uses:
01_中文_繁体/手写for handwritten Traditional Chinese.02_中文_简体/可爱for cute Simplified Chinese.03_英文西文/衬线for a classic English serif.
The counts sum to more than 33,365 because the hard-linked bilingual fonts are counted in both Chinese trees. That is expected, not a duplicate leak.
The Index Is the Actual Interface
The generated 00_索引/index.html is a static gallery with filters for
script, style, language, licence clue and source. It renders a sample line
for each family and exposes the path. 全库.html is the full 33,365-row
table; fonts_index.csv is the same data for scripts and spreadsheets. The
SQLite database behind it stores the family name, style tags, format, file
size, MD5, source package and licence clue.
The index is what makes the library usable. A folder can answer “show me the handwritten Traditional Chinese directory”. It cannot answer “show me handwritten Traditional Chinese families that are not already in the curated set and came from a commercial package” without a second layer. The index can.
The gallery is static HTML. It has no server process and no database connection at read time; the data is baked in at generation. That matters on a NAS share that is opened from Windows, macOS and a container: the same file works everywhere, and no one needs to install a font manager to search the library.
The Synology Drive Conflict
I moved tens of thousands of files while Synology Drive was syncing the same
share; that produced about 800 *_Conflict* copies. The index briefly
pointed at paths that had been renamed by the sync client. I stopped the
SynologyDrive package, removed the conflict copies, rebuilt the index
paths, and restarted the package. The final check reported 0 conflict
copies and 0 missing paths.
The operational lesson is simple: a sync client is another writer. During a large move, it is not a passive observer. Stop it, or move the data on a share that the client does not watch.
The Licence Caveat
I treat _可商用字体 as a source label, not a per-font licence. The package
carried five general licence images (OFL, MIT, GPL, IPA and one more), not a
one-to-one mapping from every font file to its terms. Many archives
contained no licence file at all; one 198-font package had two licence
files.
The 27 remaining archives in 06_原始包 are kept as evidence of where the
fonts came from. I do not treat them as proof that every font is cleared for
client work. A font used in a deliverable still needs its own licence check,
especially for embedding, web use, or redistribution.
The Result
The project started with a 130 GB share that could not answer a simple design question. It passed through a 302 GB peak, 64,941 candidate paths, 32,095 duplicate-path removals, and 35,917 more duplicates found in the second archive wave. It ended at 33,365 unique fonts in 129 GB, with a 280-font curated set and a generated index.
The numbers that matter for the next cleanup:
- 130 GB → 302 GB → 129 GB: the middle number is the cost of unpacking before deleting.
- 64,941 → 32,846 → 33,365: the first pass removed 32,095 paths; the second added 519 fonts.
- 32,095 duplicate paths were removed in the first pass; 35,917 more duplicate fonts were discarded in the second.
- 800 conflict copies were removed after the sync client was stopped.
- 0 missing paths in the final index.
The reusable design is not the folder names. It is the separation between a small curated set, a complete indexed library, and untouched source archives. The folder is for browsing; the index is for answering a question.
Want a 24/7 bot or automation pipeline that never drops a lead?
Don't let customer inquiries slip away at midnight or on weekends. I build custom Telegram/WhatsApp AI assistants and deterministic workflows that connect directly to your catalogue, CRM, and order fulfillment.