<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ali Builds Things]]></title><description><![CDATA[Practical guides on PDFs, files and small automation tools, from a builder of free online tools.]]></description><link>https://alibuildsthings.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/6af6b1a97ad7ca75337c6be7/08d46c02-e861-4e09-bfdb-23298f795c46.png</url><title>Ali Builds Things</title><link>https://alibuildsthings.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Wed, 18 Nov 2026 14:03:44 GMT</lastBuildDate><atom:link href="https://alibuildsthings.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[How to Bulk Rename PDF Files by Their Content (Free, No Upload)]]></title><description><![CDATA[Rename PDFs by the text inside them, free and without uploading: a no-code browser tool or a tested Python script that handles duplicates.]]></description><link>https://alibuildsthings.hashnode.dev/bulk-rename-pdf-files-by-content</link><guid isPermaLink="true">https://alibuildsthings.hashnode.dev/bulk-rename-pdf-files-by-content</guid><category><![CDATA[pdf]]></category><category><![CDATA[Python]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[automation]]></category><dc:creator><![CDATA[Muhammad Ali Qureshi]]></dc:creator><pubDate>Tue, 17 Nov 2026 05:35:49 GMT</pubDate><content:encoded><![CDATA[<p>If you download invoices, bank statements or scanned forms, you know the folder: <code>document(17).pdf</code>, <code>scan_0042.pdf</code>, <code>download (3).pdf</code>. The useful name is <em>inside</em> each file, usually in the first line: "Invoice 2026-1043", "Bank Statement: October 2026".</p>
<p>Renaming them one by one means opening every PDF, copying the heading and pasting it into the file name. Here are three free ways to do it in bulk, from no-code to a small script, and what each one can and can't do.</p>
<h2>Why most "bulk rename" tools don't solve this</h2>
<p>Classic renamers such as Bulk Rename Utility or Microsoft PowerToys (PowerRename) are excellent, but they work on the <strong>file name</strong>: patterns, numbers, find-and-replace. They don't read the text inside a PDF.</p>
<p>The tools that <em>do</em> read the content are mostly cloud services. You upload the PDFs, an AI or OCR engine reads them, and you download renamed files. That works, but it has two catches:</p>
<ul>
<li><strong>Your documents leave your computer.</strong> For invoices, statements or ID scans that's a real privacy question, even when the files are deleted after a few hours.</li>
<li><strong>Free tiers are small.</strong> Typical limits are a handful of files or a few tasks per hour, and enterprise "document processing" platforms want a demo call first.</li>
</ul>
<p>So the question is: can you rename by content, for free, without uploading anything? Yes.</p>
<h2>Option 1: Pattern renaming (when you don't need the content)</h2>
<p>If you just want order, a numbered pattern is enough: <code>Invoice-01.pdf</code>, <code>Invoice-02.pdf</code>, and so on.</p>
<ul>
<li><strong>Windows:</strong> PowerToys → PowerRename (free from Microsoft), or select the files in Explorer and press F2 for a quick numbered series.</li>
<li><strong>Mac:</strong> select the files in Finder → right-click → Rename → Format.</li>
</ul>
<p>Fast and offline, but the names say nothing about what's in each file.</p>
<h2>Option 2: A browser tool that reads the first line (no code)</h2>
<p>I build free PDF tools, and one of them is a <a href="https://www.quickcatpdf.com/pdf-rename-tool/">PDF Rename Tool</a> that runs entirely in the browser. The PDFs are read on your own device and aren't uploaded.</p>
<ol>
<li>Open the tool and add your PDFs (up to 500 at once).</li>
<li>Under <strong>Rename using</strong>, choose <strong>The first line of text</strong> (or <strong>The PDF title</strong> if your files have proper titles).</li>
<li>Check the preview table: old name on the left, new name on the right.</li>
<li>Click <strong>Rename files</strong> and download the ZIP.</li>
</ol>
<p>A few details that matter in practice:</p>
<ul>
<li><strong>Duplicates are handled.</strong> Two files that both start with "Invoice 2026-1043" become <code>Invoice 2026-1043.pdf</code> and <code>Invoice 2026-1043 (2).pdf</code>.</li>
<li><strong>Illegal characters are removed</strong>, so a heading like "Statement: October" becomes a valid file name.</li>
<li><strong>The files themselves aren't changed</strong>, only renamed (unless you tick the option to also set the new name as the PDF's title).</li>
<li>A browser can't rename files on your disk directly, so you get renamed <strong>copies</strong> in a ZIP.</li>
</ul>
<p>The limit: it uses the first line of text (or the title). If the useful part is somewhere else on the page, like an invoice number in the top-right corner below the logo, you'll want Option 3.</p>
<h2>Option 3: A small Python script (full control)</h2>
<p>If you're comfortable with Python, 20-odd lines do the same job locally, and you can change which text is used. This version uses <code>pypdf</code> (<code>pip install pypdf</code>), starts in <strong>dry-run mode</strong> so you can check the names first, and handles duplicates, illegal characters and damaged files:</p>
<pre><code class="language-python">import re
from pathlib import Path
from pypdf import PdfReader  # pip install pypdf

FOLDER = Path("pdfs")
DRY_RUN = True  # change to False to really rename

taken = {p.name.lower() for p in FOLDER.glob("*.pdf")}
for pdf in sorted(FOLDER.glob("*.pdf")):
    try:
        reader = PdfReader(pdf)
        text = (reader.pages[0].extract_text() or "") if reader.pages else ""
    except Exception:
        text = ""  # damaged or password-protected: keep the old name
    first = next((line.strip() for line in text.splitlines() if line.strip()), "")
    base = re.sub(r'[&lt;&gt;:"/\\|?*\x00-\x1f]', "", first)[:60].strip(" .") or pdf.stem
    new, n = f"{base}.pdf", 2
    while new.lower() in taken and new.lower() != pdf.name.lower():
        new = f"{base} ({n}).pdf"
        n += 1
    taken.discard(pdf.name.lower())
    taken.add(new.lower())
    print(f"{pdf.name}  -&gt;  {new}")
    if not DRY_RUN:
        pdf.rename(FOLDER / new)
</code></pre>
<p>On a test folder it printed:</p>
<pre><code class="language-plaintext">scan_0000.pdf  -&gt;  Invoice 2026-1043.pdf
scan_0001.pdf  -&gt;  Invoice 2026-1043 (2).pdf
scan_0002.pdf  -&gt;  Bank Statement October 2026.pdf
scan_0003.pdf  -&gt;  scan_0003.pdf      (blank page: name kept)
broken.pdf     -&gt;  broken.pdf         (damaged file: name kept)
</code></pre>
<p>To use a different field, replace the <code>first = ...</code> line with a regular expression, for example <code>re.search(r"Invoice\s*(?:No\.?|#)?\s*(\d+)", text)</code> to pull out just the invoice number.</p>
<p>One honest caveat: <code>extract_text()</code> returns lines in the order they're stored in the PDF, which is <em>usually</em> but not always top-to-bottom. Always look at the dry-run output before renaming. (The browser tool in Option 2 sorts text by its position on the page for this reason.)</p>
<h2>What about scanned PDFs?</h2>
<p>A scan is a picture of a page: there's no text inside it to read. Both the browser tool and the script will simply keep the old name. You need OCR (text recognition) first. Many scanners can save a "searchable PDF" directly, and that's the easiest fix. After that, either option works.</p>
<h2>Quick tips</h2>
<ul>
<li><strong>Rename copies first.</strong> Keep the originals until you've checked the new names.</li>
<li><strong>Keep names short.</strong> 60 characters is plenty and avoids path-length problems on Windows.</li>
<li><strong>Add a date or number for sorting</strong>, e.g. <code>2026-10 Bank Statement.pdf</code>, so files line up in order.</li>
</ul>
<h2>FAQ</h2>
<p><strong>Is there a free way to rename PDFs by their content?</strong> Yes: an in-browser tool (no upload, no sign-up) or a short Python script. Pattern renamers like PowerRename are free too, but they can't read the content.</p>
<p><strong>How many PDFs can I rename at once?</strong> The browser tool takes up to 500 per batch; the script has no limit.</p>
<p><strong>Will renaming change my PDFs?</strong> No. Only the file name changes; the content stays byte-for-byte the same.</p>
<hr />
<p><em>I build free online tools, including the QuickCatPDF PDF Rename Tool mentioned in Option 2. Options 1 and 3 don't need anything from me.</em></p>
]]></content:encoded></item></channel></rss>