📄

Smart PDF Rename

Rename PDF files based on their internal text content (e.g., Finding the 'Invoice Number' inside the file).

Document ⭐⭐⭐ Advanced ⏱️ 10 minutes

😫 The Pain Point

Scanners give files useless names: Scan_001.pdf. You have to open Scan_001.pdf, see that it’s “Invoice 12345”, close it, rename it. Doing this for 100 files in a row is mind-numbing.

🚀 Agentic Solution

Intelligent Renamer: Reads the PDF like a human, matches a pattern (Regex), and renames the file automatically.

Key Features:

  • Pattern Match: Looks for “No: XXXXX” or “Date: YYYY-MM-DD”.
  • Preview: Shows you what the new name will be before committing.

⚔️ Phase 1: Commander (Quick Fix)

For a specific rename job.

Prompt:

“I have invoice PDFs. Read each file’s text. Find the number after ‘Invoice No:’. Rename the file to that number plus ‘.pdf’. Eg: ‘Invoice No: 99’ -> ‘99.pdf’.”

Result: Organized files.

🏗️ Phase 2: Architect (Permanent Tool)

For Accountants.

Engineering Prompt:

**Role:** Python Automation Developer
**Task:** Create a "Smart PDF Renamer".
**Requirements:**
1.  **GUI:**
    *   Select Folder.
    *   Input Regex Pattern (e.g., `Invoice:\s*(\d+)`).
    *   "Preview" button (Comparison Table).
    *   "Apply" button.
2.  **Logic:**
    *   Extract text from page 1.
    *   Regex Search.
    *   Generate New Name.
    *   Safe Rename (Handle duplicates).
3.  **Deliverables:** `pdf_renamer.py`, `run.bat` (Windows), `run.sh` (Mac).

🧠 Prompt Decoding

  • User Verification: Automating renaming is risky (what if it renames wrong?). The “Preview” step is a critical safety feature that distinguishes a professional tool from a reckless script.

🛠️ Instructions

  1. Copy Prompt -> Paste -> Run.
  2. Set Pattern -> Preview -> Apply.

Related Workflows

Explore other categories

📬

Get Started with Agentic Working

Subscribe to receive updates from AgenticWorking.io

📖 Free eBook Guide 📦 7 Ready-to-use Scripts 🔔 Weekly Tips

No spam, unsubscribe anytime. Join 1,000+ subscribers.