New Tool Radar

AI PDF

How to Rename a Batch of Scanned PDFs from Their OCR Text

Rename a batch of scanned PDFs from the text OCR finds inside them so the filenames say what each file is.

Schematic illustration of batch renaming: OCR the batch, read the title from each file, and rename the files.

A folder of files named scan001.pdf through scan120.pdf is unsearchable, but each file holds its own title on the first page. OCR can read that title and a script can rename the file after it. This guide renames a small batch that way and checks the results.

Prerequisites

A folder of scanned PDFs, OCRmyPDF with the –sidecar option, and a renaming script or tool. Work on copies of the files until the renaming is proven.

Steps

1. OCR the batch with sidecar files

Run OCRmyPDF with –sidecar on the batch. Expected result: each PDF gains a sidecar text file with its OCR text.

2. Read the title from each sidecar

Read the first line of each sidecar file. Expected result: four titles are found, one per file.

3. Rename each file after its title

Rename each PDF after the title on its first page. Expected result: four files are renamed, each with a descriptive name.

4. Check every renamed file opens

Open each renamed PDF and check its first page. Expected result: each file opens and its title matches its new name.

Practice check: fictional batch of four scanned letters

The table below is fictional practice material. It lists the four files and the names they must take.

Old name New name
scan001.pdf letter-harvest-2026-11-02.pdf
scan002.pdf letter-market-2026-11-05.pdf
scan003.pdf letter-garden-2026-11-09.pdf
scan004.pdf letter-season-2026-11-12.pdf

Expected result. all four files are renamed after the title on their first page, and each renamed file opens with the matching title.

Limits

  • OCR can misread a title, so a renamed file can carry a wrong name; check the first page of every renamed file before deleting the originals.
  • UNTESTED – no OCR tool or AI tool was run; all results above are expected results. The practice file is fictional.

Sources

  • OCRmyPDF Cookbook – –sidecar writes OCR text to a companion file; –output-type pdfa/pdf picks the output; –optimize shrinks the file; –mode strip removes the text layer. Checked 2026-11-29.
  • Tesseract OCR Documentation, output formats – Tesseract supports plain text, searchable PDF, hOCR, TSV, ALTO and PAGE output; –psm sets the page segmentation mode. Checked 2026-11-29.
See all