Why Cross-Folder Renaming Needs a Different Approach
A normal batch rename works on the files sitting in one directory. Point it at a folder that contains twenty subfolders and, by default, it touches nothing inside them. To reach the whole tree, the tool has to recurse, which means it walks into every subfolder, and every subfolder below that, applying the same rename rule as it goes.
Recursion introduces three concerns that a single-folder rename never has to think about. First, structure: the goal is almost always to rename files in place, not to flatten a tidy tree into one crowded directory. Second, scope: a deep tree often contains subfolders that should be left alone, an archive, a node_modules, a backup, so the recursion needs a way to exclude them. Third, safety: a scripted recursive rename runs across hundreds of files at once and, on the command line, there is no undo button. A mistake in the pattern hits the entire tree before anyone notices.
The three methods below handle all three concerns, they differ mainly in how much manual pattern work they demand and whether they can name files by their actual content.
Method 1: Recursive Renaming on the Command Line
The command line is the fastest route when the new names follow a predictable rule, a find-and-replace on the existing name, a prefix, a sequence number, and when the person running it is comfortable reading a preview before committing.
On Windows PowerShell, Get-ChildItem walks the tree and pipes each file into Rename-Item. To lowercase every file across a tree and preview the result first, run Get-ChildItem -Path C:\Scans -Recurse -File | Rename-Item -NewName { $_.Name.ToLower() } -WhatIf. The -Recurse flag is what makes it cross subfolders, and -WhatIf is the critical part: it prints exactly what would be renamed without changing a single file. Remove -WhatIf only once the printed plan looks correct. To swap text in every name, for example turning scan into invoice, use -NewName { $_.Name -replace 'scan','invoice' }. Because Rename-Item renames a file where it already lives, the folder structure is preserved automatically.
The classic CMD equivalent uses FOR /R, which loops recursively from a starting folder. A command such as FOR /R C:\Scans %f IN (*.pdf) DO REN "%f" "renamed_%~nxf" walks every subfolder and renames each PDF in place. CMD has no built-in preview, so it is safer to first run the same loop with ECHO REN instead of REN to print the intended commands.
On macOS or Linux, find does the recursion. find ./Scans -type f -name '*.pdf' -exec rename 's/scan/invoice/' {} + hands every matching file to the rename utility, which applies a Perl-style substitution across the whole tree. Where the rename command is not installed, a shell loop does the same job: for f in $(find ./Scans -type f -name '*.pdf'); do mv "$f" "$(dirname "$f")/new_$(basename "$f")"; done. Note the use of dirname, it puts each renamed file back into its own folder rather than moving it. To preview, echo the mv line instead of running it.
Command line recursion is powerful and free, but it renames purely from the old filename. It cannot look inside a scanned PDF, so it cannot turn scan_001.pdf into a name that reflects the document, that is the limit of every rule-based approach.
For anyone who wants a visible grid and a live preview rather than a scripted command, dedicated renamers handle recursion through the interface.
Bulk Rename Utility, on Windows, has a Subfolders option in its file tree. Enabling it loads every file beneath the selected top folder into one flat list, while each file keeps its real path. The rename rules, replace, numbering, case, trim, apply across the whole tree at once, and the New Name column updates live so the outcome is visible before the Rename button is pressed. Files stay in their original folders.
Advanced Renamer works the same way through its Add folders dialog, which offers a recursive Include subfolders switch. It builds a rename batch across the tree, shows a before-and-after preview for every file, and supports methods stacked in sequence. Both tools let specific subfolders be excluded, either by not adding them or by filtering them out of the loaded list, which covers the archive-and-backup exclusion concern.
GUI subfolder mode is the sweet spot for structured, rule-based renames across a tree, no scripting, a real preview, structure preserved. Like the command line, though, these tools read filenames and file metadata, not the content of the document itself.
Method 3: Content-Aware Renaming Across the Tree
The methods above all share one ceiling: they can only rearrange the names that already exist. When the existing names carry no meaning, a tree full of scan_001.pdf, IMG_2231.pdf, and Document(3).pdf, a find-and-replace just produces differently meaningless names.
Unlike rule-based renamers that only see filenames, renamer.ai reads the actual document content (OCR + AI vision) to generate descriptive names automatically. Pointed at the top of a folder tree with recursion enabled, it opens each file wherever it lives, reads the invoice number, vendor, date, or subject inside it, and writes a descriptive name using the chosen template, then leaves the file in its original subfolder. A scattered tree of look-alike scans comes out as a set of consistent, self-describing names in a single pass, without anyone writing a pattern.
This is the approach to reach for when the files are documents, scanned invoices, contracts, receipts, statements, rather than assets with names worth preserving. For a deeper walkthrough of the content-reading step itself, see the guide on how to rename scanned PDF files.
Recursive rename methods compared
| PowerShell / find (recursive script) | Bulk Rename Utility (subfolder mode) | Content-aware (renamer.ai) |
|---|
| Recurses subfolders? | Yes, via -Recurse or find | Yes, Subfolders option | Yes, points at the top folder |
| Preview before running? | Yes, -WhatIf or echo | Yes, live New Name column | Yes, proposed names shown |
| Reads file content? | No, filename only | No, filename and metadata | Yes, OCR + AI vision |
| Best for | Rule-based renames when scripting is comfortable | Rule-based renames with a visual preview | Meaningless names that need real content-based names |
A Recursive Before and After
Consider a Scans folder with two subfolders, one named 2024 and one named 2025, and inside each of them a file called scan_001.pdf, scan_002.pdf, and scan_003.pdf. Six files, but only two distinct names repeated across the tree. A rule-based recursive rename can prefix them, but it cannot tell the 2024 copy of scan_001.pdf from the 2025 copy by anything except the folder it sits in.
Before, across the tree: /Scans/2024/scan_001.pdf, /Scans/2024/scan_002.pdf, /Scans/2024/scan_003.pdf, /Scans/2025/scan_001.pdf, /Scans/2025/scan_002.pdf, /Scans/2025/scan_003.pdf.
After a content-aware pass, each file is named from what it contains while staying in its own folder: /Scans/2024/acme-invoice-4471-2024-03-12.pdf, /Scans/2024/northwind-receipt-2024-05-08.pdf, /Scans/2024/citypower-statement-2024-09-30.pdf, /Scans/2025/acme-invoice-5120-2025-02-19.pdf, /Scans/2025/northwind-receipt-2025-04-22.pdf, /Scans/2025/citypower-statement-2025-08-11.pdf.
The tree is untouched, nothing was flattened or moved, and every file now carries a unique, sortable name that no filename-only tool could have produced from the identical scan_001.pdf inputs.
Scattered Scans Still Need OCR
The reason a filename-only tool hits a wall on a folder tree of scans is the same reason it hits a wall on a single folder of them: a scanned PDF is an image of a page, and its text is not stored as characters the computer can read. Optical character recognition is the step that converts that image into words, so scan_001.pdf becomes a document whose invoice number, vendor, and date can actually be read.
Spreading those scans across many subfolders does not change the requirement, it multiplies it. Every branch of the tree holds documents that are opaque to a rule-based rename, and each one needs OCR before a meaningful name can be generated. A content-aware pass applies that recognition to every file in the tree at once, which is why a recursive, content-based rename is the only route that produces descriptive names for scattered scans rather than just tidier versions of the same unreadable filenames.