How to Sort Files Into Folders Based on Content (Not Just Names)
Sort files into folders based on content, not the file name, using free OS tools or a rule-based app. Covers what content matching can and can't read.
You can sort files into folders based on content — the actual text inside a PDF, Word document, or plain-text file — instead of relying on the file name or extension. Windows and Mac both offer a free, manual way to do this through built-in search. For ongoing volume, a rule-based app reads the text inside each incoming file and routes it to the right folder automatically, and can rename it from what it read if you ask.
This guide covers three ways to do it, from a five-minute search trick to a rule that runs every time a file arrives. It also covers renaming from content, which Hazel and File Juggler have done for years and File Arbor Pro added in 1.3.0. One limit is worth knowing before you read any further: a scan or a phone photo of a page has no text layer, so there is nothing for a rule to read unless the tool runs OCR first — Hazel 6 does on a Mac, and File Arbor Pro does since 1.3.0.
Why Doesn't Sorting by File Name or Type Work?
A file name tells you what someone typed into a save dialog, which is often nothing useful. scan0043.pdf, Untitled document.docx, and download (3).pdf describe nothing about what's inside. Sorting by extension is not much better — knowing a file is a PDF tells you it's a PDF, not whether it's a lease, a receipt, or a recipe someone saved for later.
This gets worse at scale. A freelancer's Downloads folder fills up with client PDFs that all arrive named after some upstream system's export job. A student's folder fills with lecture-slide exports that all start with the same course code. Name-based and type-based rules can catch the obvious cases — route every .jpg to Photos, every .dmg to Installers — but they can't tell an invoice from a contract when both are PDFs with meaningless names.
Content-based sorting solves a narrower problem than people expect: it doesn't understand your files. It reads specific text and moves the file to a specific folder when that text is present. That's a smaller promise than "AI organizes your documents for you," and it's also a promise that's easier to trust, because the same file produces the same result every time.
Two Free Ways, Then the Automated One
The first two methods below cost nothing and use tools already on your computer. The third requires a dedicated app, but it's the only one that keeps working without you.
Method 1: Search Your Existing Files by Content
Both operating systems index the text inside your files for search, and you can use that index to find and move files right now.
On Mac: Open Spotlight or a Finder window, type the text you're looking for, and set the search scope to file contents rather than file name. Select the matches and drag them into the destination folder.
On Windows: Open File Explorer, make sure content indexing is turned on for the folder (Indexing Options in Control Panel), then search the folder using the text you expect inside the file. Windows Search checks file contents for common formats like PDF, DOCX, and TXT once they're indexed.
This works well for a one-time cleanup of a folder that's already a mess. It does nothing for the next file that lands there tomorrow — you'd have to run the same search again. Treat it as a way to clear a backlog, not a permanent fix.
Method 2: Stitch Together Your OS's Built-In Automation
Both platforms have free automation tools that can, with some setup, act on file contents instead of just watching for a file to appear.
On Mac, an Automator Folder Action can run a shell script against a newly added file — for example, piping a PDF through a text-extraction command and checking the result for a keyword before moving the file. Apple Shortcuts can do a simpler version of the same thing for text and PDF files.
On Windows, Power Automate Desktop can watch a folder and run a flow when a file arrives, but reading text out of a PDF or DOCX file requires adding extra actions or a plugin, and testing usually takes longer than the tutorial suggests.
Both approaches are genuinely free. Neither is quick. You're assembling a trigger, a text-extraction step, and a move action yourself, and if the extraction step doesn't handle a particular PDF layout well, the rule silently does nothing. This is the honest trade-off of the built-in route: no cost, real setup time, and you're on your own when something doesn't match.
Method 3: Set Up a Content Rule in a Dedicated File Organizer
A dedicated rule-based file organizer turns the same idea into a condition you set once. In File Arbor, a content rule looks like this:
- Watch:
Downloads - Condition: content contains
invoice, receipt - Action: Move to
Documents/Finance
Comma-separated terms mean "match any of these," so this one rule catches either word. Content matching is also accent- and case-insensitive — a rule that matches muller will also catch Müller, and cafe will catch café — so you don't need to account for every capitalization or accent variant yourself.
Under the hood, File Arbor detects the file type from its actual content rather than trusting the extension, and only extracts text when a rule needs it, so files that don't match any content rule are never scanned. It reads PDFs that contain a text layer, DOCX files, and plain-text formats like TXT, MD, and CSV. There are limits: 32 MB per file, the first 256 KB of extracted text, the first 20 pages of a PDF, and a 5-second processing window per file. Nothing extracted is written to disk or logged anywhere. Since 1.3.0, a Pro rule set to also read scanned documents reads scanned PDFs and photos (JPEG, PNG, TIFF) with OCR as well: the first and last page, at about a second per page.
Content conditions are a Pro feature, added in version 1.2.0. The free tier still covers rules by file extension for one folder — content matching is where the paid tier starts to matter.
Does Content-Based Sorting Rename Your Files?
Not on its own. A content condition decides which folder a file goes to and nothing else. Renaming is a separate part of the rule: since 1.3.0, a File Arbor rule can also rename the file, and in Pro the new name can include values read from the document — a date, an amount, an invoice number — which you teach it by clicking the value once on a sample document, or by typing the label printed next to it. How to rename PDF files based on their content walks through it with an invoice date.
Two of the alternatives did this first, and it would be misleading to imply otherwise. Hazel's Contents contain match condition can capture part of a document into a custom token, which you can then use in a rename action — Noodlesoft documents this directly. File Juggler can build file names from patterns and word-list variables it finds inside a document. If renaming from content is the job you actually have, all three tools now do it, File Arbor since 1.3.0.
It's worth being explicit about this, because most of what ranks for "sort files by content" right now is a different category of tool entirely. A whole category of AI tools reads a document and generates a new file name from what's inside it — pulling a client name, a date, or a document type out of the text and building something like 2026-04-12-acme-invoice.pdf. That's a real and useful feature, and it's different from what Hazel, File Juggler and File Arbor do: those capture text deterministically, with a pattern you wrote or a value you pointed to, rather than having a model infer a name. If AI-generated names are what you're after, that's a different category of tool than the one this article covers.
Rule-based content matching is a narrower, more predictable tool: the same file, matched against the same rule, lands in the same folder every time. Nothing is inferred. Nothing changes about the file itself except its location, and its name if the rule renames it.
What Content-Based Sorting Can't Read
Every content-matching tool has real limits, and they matter more than the feature list. In File Arbor, none of the following will match a content condition:
- Scanned documents and photos of paper, unless the rule reads scans. These have no text layer, so there's nothing for the rule to read until OCR runs. Since 1.3.0, a Pro rule set to also read scanned documents runs OCR on the first and last page; without that, a scanned invoice looks, to the file system, identical to a picture of a cat.
- Spreadsheets. XLSX files aren't read for content.
- Word document headers, footers, and footnotes. Only the main body text is checked.
- Encrypted or password-protected PDFs. These can't be opened for text extraction without the password.
Encrypted PDFs are a real gap, not a minor footnote, and the one place a competitor genuinely does more. Hazel 6 added on-the-fly text recognition for non-OCRed files and a way to supply a password for encrypted PDFs. File Arbor Pro added OCR in 1.3.0, but it has no way to open an encrypted PDF. If your PDFs are routinely encrypted, Hazel (Mac only) will match files that File Arbor's rules will silently skip.
The practical step is to check whether your PDFs have a real text layer before building a rule around them; if they don't, the rule has to read scanned documents. A PDF exported from Word or a modern scanner app usually does. A PDF produced by pointing a phone camera at a page usually doesn't.
Using Regex to Match What's Inside a File
Plain-text matching like content contains invoice handles most cases, but sometimes you need a pattern instead of a word — an invoice number in a specific format, or a reference code that always starts the same way. File Arbor's second content condition, content matches a regex, applies a regular expression to the extracted text instead of a literal word. Unlike content contains, it's literal — no accent or case normalization — and every pattern is checked against catastrophic backtracking before it runs.
If you haven't written a regex pattern before, don't start here. Our regex file organization guide covers the syntax from scratch with ten copy-paste patterns for file names. The same patterns apply to file contents — the difference is which text the pattern runs against, a file name versus the text extracted from inside the file.
How Does This Work Across Windows and Mac?
Only one way, if you want the identical rule on both operating systems: use a tool built for both. Hazel's content conditions only exist on macOS. File Juggler's only exist on Windows. If you use both platforms, or you switch between them, neither tool's rules travel with you.
| Feature | File Arbor | Hazel | File Juggler | organize (CLI) |
|---|---|---|---|---|
| Platform | Windows & Mac | Mac only | Windows only | Windows, Mac & Linux |
| Interface | Graphical | Graphical | Graphical | Command line (YAML) |
| Content conditions | Yes (Pro) | Yes | Yes | Yes |
| Reads PDF / DOCX / text | Yes | Yes | Yes | Yes |
| OCR for scanned PDFs | Yes (Pro, since 1.3.0) | Yes | No | Not documented |
| Encrypted PDF support | No | Yes | No | No |
| Regex on file contents | Yes | Partial | Yes | Yes |
| Rename a file from its contents | Yes (Pro, since 1.3.0) | Yes | Yes | Yes |
| Real-time folder watching | Yes (Pro) | Yes | Yes | No (needs a wrapper) |
| Free tier | Yes (one watched folder, two rules, up to 20 files a day, manual runs) | No (14-day trial) | No (30-day trial) | Yes (free, open source) |
| Price | $24.99 Pro, one-time | $42 one-time | One-time license | Free |
File Arbor's position here is narrow and specific: the same two content conditions, on both operating systems, from one app, checked against a folder in real time by Auto Mode. It's not more powerful than Hazel on a Mac or File Juggler on Windows — it's the one that doesn't make you pick a platform.
Which Method Should You Use?
"I have an existing mess and just want it cleared once." Use Method 1. A content search plus a manual drag beats building any kind of automation for a one-time job.
"I don't mind scripting and I only use one OS." Method 2 costs nothing and works, if you're willing to build and test the flow yourself.
"I'm on Mac only and want deep content matching, including OCR." Hazel is worth a look: it matches text inside documents and reads scanned PDFs with built-in OCR.
"I'm on Windows only and want a mature, visual rule builder for document content." File Juggler has a long track record with PDF and Word content matching, including regex and word-list variables.
"I use both Windows and Mac, or I want to try content rules before paying for anything." File Arbor is built for this — the same rule works on both platforms, and the free tier lets you test rules by file extension before deciding whether content matching is worth the Pro upgrade.
"I want config-as-code and I'm comfortable with YAML." organize is free, cross-platform, and reads PDF and DOCX content — you just don't get a graphical interface.
Keeping Content-Based Folders Organized Going Forward
Start with one folder and one rule — your Downloads folder is usually the highest-traffic candidate. Pick a single, unambiguous word or phrase you know appears in the files you want to catch, and route it somewhere specific rather than trying to sort everything on day one.
Preview matches before you turn on real-time automation. A content rule that's slightly too broad will catch files you didn't intend, and it's much easier to fix a rule against a batch of existing files than to notice a wrong move after the fact.
Combine content conditions with a type or date condition when you can. "PDF, older than a day, containing 'invoice'" is a more precise rule than "containing 'invoice'" alone, and it's less likely to misfire on an unrelated file that happens to mention the word in passing.
FAQ
Can I sort files into folders based on what's inside them, not just the file name?
Yes. Content-based rules read the text inside a file — a PDF, a Word document, or a plain-text file — and move it to a folder based on words or patterns found there. Hazel, File Juggler, the open-source tool organize, and File Arbor all support some version of this, and all four can also build a new file name from what they read; File Arbor Pro added that in 1.3.0.
Does content-based file sorting rename my files based on what's inside them?
Only if you ask it to. A content condition on its own only decides the destination folder. Since 1.3.0, File Arbor Pro can also read values such as an invoice date from the document and build the file name from them, as Hazel, File Juggler and organize can. AI tools also rename from content, by inferring a name rather than capturing one with a pattern.
Can content-based rules read scanned PDFs or photos of documents?
Only in tools that run OCR. Content matching depends on a text layer, and a scanned PDF or a photo of a document has none, so a content condition has nothing to read until OCR runs. Hazel 6 runs text recognition on non-OCRed files before matching, and since 1.3.0 File Arbor Pro does too when a rule is set to also read scanned documents; File Juggler's documentation says scans need a separate OCR program.
Is sorting files by content the same thing as AI file organization?
No. Content-based rules use deterministic text or regex matching, so the same file produces the same result every time, entirely offline. AI file organizers use language models to infer meaning and often suggest new file names. Both route files into folders, and both can rename them: File Arbor Pro (since 1.3.0), Hazel, File Juggler and organize build the name from values you point them to, rather than inferring one.
Does content-based file sorting work the same way on Windows and Mac?
Only if the tool is cross-platform. Hazel's content conditions are Mac-only, and File Juggler's are Windows-only. File Arbor runs the same two content conditions — content contains and content matches a regex — natively on both Windows and macOS from a single app.
Is content-based sorting available in File Arbor's free tier?
No. Content conditions are a Pro feature. The free tier covers one watched folder, two rules, up to 20 files a day, manual runs, matching by file extension. Content-based conditions, along with Auto Mode and unlimited rules, require the $24.99 one-time Pro upgrade.
The Takeaway
In File Arbor, sorting files by content means routing them by what's written inside — and since 1.3.0, Pro can rename them from it too, as Hazel and File Juggler can. Windows and Mac both let you do this manually for free through search, and both let you automate it with enough scripting patience. A dedicated rule-based app — File Arbor, Hazel, or File Juggler, depending on your platform — turns the same idea into a rule you set once and forget.
If you work across both Windows and Mac, download File Arbor and try a content rule on your Downloads folder. The free tier is enough to see whether rules by file extension cover your case; Pro is there when you're ready to add content matching.