
Automatic File-Sorting System
Multimodal file sorter: end inbox-of-files chaos with auditable routing #
This system ingests heterogeneous uploads—scans, phone photos, contracts, receipts—and n8n orchestrates extractors: OCR for text layers, vision models for layout/type hints, deterministic rules for final path selection, with checksum dedupe and a dead-letter lane so a single corrupted PDF never wedges the nightly batch. Compliance-friendly orgs get CSV audits per run, not mystery moves.
Who is this automation built for? #
- Ops teams with shared drives that turned into junk drawers.
- Legal/finance needing separation of sensitive docs without interns hand-clicking.
- Studios managing large inbound asset floods (video stills, brand packs).
What goes wrong when file triage is manual? #
- Search fails: Nobody names files consistently; institutional memory is required to find anything.
- Compliance gaps: Sensitive docs sit next to public marketing flats.
- Human fatigue: Thundering herds of “misc” folders grow faster than cleanup Fridays.
What you receive at handoff #
- n8n batch workflows with concurrency controls aligned to vendor rate limits.
- Taxonomy YAML mapping tags → folder targets.
- Model/router matrix stating which MIME types hit which extractors.
- Dead-letter SOP for humans when confidence < threshold.
- Retention policy hooks (lifecycle transitions to cold storage nodes optional).
Architecture at a glance #
| Stage | Role | Tech |
|---|---|---|
| Intake | List/upload events | Drive/S3/blob triggers |
| Extract | Text | OCR / pdf parsers |
| Classify | Semantics | Vision / LLM |
| Decide | Policy | Rules engine in Code |
| Move | Storage writes | API moves with retries |
| Audit | Proof | CSV/DB row |
| Orchestrate | Glue | n8n |
End-to-end execution flow #
- Enumerate batch; compute
sha256for dedupe registry lookup. - Branch on MIME: pdf, image, office, unknown.
- Extract text snippets + optional embeddings for similarity clustering.
- Classify with calibrated confidence; if low, route
needs_review. - Compute destination path from taxonomy + metadata.
- Move/copy with idempotency keys; verify listing succeeded.
- Append audit log row; notify Slack summary with counts.
Stack, APIs, and orchestration #
- n8n for long IO-bound graphs; avoid loading multi-GB files fully into memory—stream when possible.
- Self-hosted OCR option for air-gapped clients.
AI: where models help—and where they do not #
Models suggest categories. Legal holds & privilege tags require human classification unless your counsel blesses automations.
Errors, retries, and human checkpoints #
- Partial move failures: compensating transactions (move back) scripted when APIs allow.
- Poisoned file: quarantine bucket with AV scan hook if policy demands.
Security, privacy, and data boundaries #
Files may hold HIPAA/PII—encrypt at rest, restrict service accounts, log access centrally.
Deployment and environments #
- Dedicated service principal per sensitivity tier.
Engagement models #
- One-time migration burst + ongoing incremental watcher workflow.
Manual folders vs automated taxonomy #
| Dimension | Manual | Sorter |
|---|---|---|
| Consistency | Poor | Rule+model blend |
| Speed | Slow | Batch overnight |
| Auditability | Weak | CSV proof |
| Error handling | Ad hoc | Dead-letter |
Frequently asked questions #
Cloud provider lock-in? #
Abstract storage via node pattern; swap S3 ↔ Azure with equivalent nodes.
Mac metadata resource forks? #
Strip or ignore per platform policy in preprocessor node.
Huge video files? #
Usually out of scope for vision classify—route to MAM tooling instead.
Duplicate photos from phones? #
Perceptual hash optional branch before exact checksum.
Can humans override taxonomy? #
Yes via reviewer UI writing forced_tag that bypasses model.
Languages besides English? #
OCR models per language pack; configure in router.
Next step #
Book an AI automation strategy call with sample messy folder stats (volume, MIME spread)—I’ll size batch safely before promising overnight miracles.