Home
cd ../playbooks
File OrganizationBeginner

Batch Document Processor

Process multiple documents in bulk with parallel execution

10 minutes
By communitySource
#batch#processor#bulk#automation

You need to extract data from 500 invoices, rename 1,000 photos, or transform hundreds of reports — but doing it one file at a time means days of mind-numbing repetitive work.

Who it's for: operations teams processing high-volume documents, data entry staff, administrative professionals handling bulk file tasks, analysts transforming datasets, anyone facing repetitive file-by-file work

Example

"Extract the total amount and vendor name from these 500 invoice PDFs" → All 500 processed in parallel with results compiled into a single spreadsheet, failures logged separately, and a progress summary

CLAUDE.md Template

New here? 3-minute setup guide → | Already set up? Copy the template below.

# Batch Processor

## Overview

This workflow enables efficient bulk processing of documents - convert, transform, extract, or analyze hundreds of files with parallel execution and progress tracking.

## How to Use

1. Describe what you want to accomplish
2. Provide any required input data or files
3. I'll execute the appropriate operations

**Example prompts:**
- "Convert 100 PDFs to Word documents"
- "Extract text from all images in a folder"
- "Batch rename and organize files"
- "Mass update document headers/footers"

## Domain Knowledge


### Batch Processing Patterns

```
Input: [file1, file2, ..., fileN]
         │
         ▼
    ┌─────────────┐
    │  Parallel   │  ← Process multiple files concurrently
    │  Workers    │
    └─────────────┘
         │
         ▼
Output: [result1, result2, ..., resultN]
```

### Python Implementation

```python
from concurrent.futures import ProcessPoolExecutor, as_completed
from pathlib import Path
from tqdm import tqdm

def process_file(file_path: Path) -> dict:
    """Process a single file."""
    # Your processing logic here
    return {"path": str(file_path), "status": "success"}

def batch_process(input_dir: str, pattern: str = "*.*", max_workers: int = 4):
    """Process all matching files in directory."""
    
    files = list(Path(input_dir).glob(pattern))
    results = []
    
    with ProcessPoolExecutor(max_workers=max_workers) as executor:
        futures = {executor.submit(process_file, f): f for f in files}
        
        for future in tqdm(as_completed(futures), total=len(files)):
            file = futures[future]
            try:
                result = future.result()
                results.append(result)
            except Exception as e:
                results.append({"path": str(file), "error": str(e)})
    
    return results

# Usage
results = batch_process("/documents/invoices", "*.pdf", max_workers=8)
print(f"Processed {len(results)} files")
```

### Error Handling & Resume

```python
import json
from pathlib import Path

class BatchProcessor:
    def __init__(self, checkpoint_file: str = "checkpoint.json"):
        self.checkpoint_file = checkpoint_file
        self.processed = self._load_checkpoint()
    
    def _load_checkpoint(self):
        if Path(self.checkpoint_file).exists():
            return json.load(open(self.checkpoint_file))
        return {}
    
    def _save_checkpoint(self):
        json.dump(self.processed, open(self.checkpoint_file, "w"))
    
    def process(self, files: list, processor_func):
        for file in files:
            if str(file) in self.processed:
                continue  # Skip already processed
            
            try:
                result = processor_func(file)
                self.processed[str(file)] = {"status": "success", **result}
            except Exception as e:
                self.processed[str(file)] = {"status": "error", "error": str(e)}
            
            self._save_checkpoint()  # Resume-safe
```


## Best Practices

1. **Use progress bars (tqdm) for user feedback**
2. **Implement checkpointing for long jobs**
3. **Set reasonable worker counts (CPU cores)**
4. **Log failures for later review**

## Installation

```bash
# Install required dependencies
pip install python-docx openpyxl python-pptx reportlab jinja2
```

## Resources

- [Custom Repository](https://github.com/claude-code/workflows)
- [Claude Code Hub](https://github.com/claude-code/workflows)

Get new playbooks like this one

One email a week with new Claude Code workflows. Free, like everything here.

No spam. Unsubscribe anytime.

README.md

What This Does

This workflow enables efficient bulk processing of documents - convert, transform, extract, or analyze hundreds of files with parallel execution and progress tracking.


Quick Start

Step 1: Create a Project Folder

mkdir -p ~/Documents/BatchProcessor

Step 2: Download the Template

Click Download above, then:

mv ~/Downloads/CLAUDE.md ~/Documents/BatchProcessor/

Step 3: Start Working

cd ~/Documents/BatchProcessor
claude

How to Use

  1. Describe what you want to accomplish
  2. Provide any required input data or files
  3. I'll execute the appropriate operations

Example prompts:

  • "Convert 100 PDFs to Word documents"
  • "Extract text from all images in a folder"
  • "Batch rename and organize files"
  • "Mass update document headers/footers"

Best Practices

  1. Use progress bars (tqdm) for user feedback
  2. Implement checkpointing for long jobs
  3. Set reasonable worker counts (CPU cores)
  4. Log failures for later review

Installation

# Install required dependencies
pip install python-docx openpyxl python-pptx reportlab jinja2

$Related Playbooks

File Organization

Auto-Organize Downloads Folder

Automatically sort and organize files in your Downloads folder by type, date, or custom rules.

5 minutes
Beginner
File Organization

Chat with PDF Documents

Answer questions about PDF content, summarize, and extract information

10 minutes
Intermediate
File Organization

Business Analytics Reporter

Analyze sales and revenue data from CSV files to identify weak areas, generate statistical insights, and provide strategic improvement recommendations.

10 minutes
Intermediate
File Organization

Bulk Image Extractor

Extract all images from Google Docs, PDFs, websites, and other documents in high resolution.

5 minutes
Beginner
File Organization

Document Parser

Parse complex documents while preserving structure, tables, and figures using IBM's docling library.

10 minutes
Advanced
File Organization

Document Processing Pipeline

Chain document operations into reusable pipelines

10 minutes
Advanced
File Organization

Word Document Manipulation

Create, edit, and manipulate Word documents programmatically using python-docx

10 minutes
Advanced
File Organization

7-Minute Digital Declutter

Complete digital cleanup of photos, documents, and downloads in 7 minutes with intelligent recommendations.

5 minutes
Beginner
File Organization

Disk Space Analyzer

Find exactly what's eating your disk space with categorized breakdown and prioritized cleanup recommendations.

5 minutes
Beginner
File Organization

CSV Data Visualizer

Create professional data visualizations, statistical reports, and interactive dashboards from CSV files for analysis and presentations.

5 minutes
Beginner
File Organization

Data Analyst Toolkit — CSV Analysis & Dashboard Generator

Analyze CSV and Excel data with automatic missing value detection, intelligent imputation, and interactive Plotly dashboards. Generate exploratory data analysis reports in minutes with Claude Code.

10 minutes
Intermediate
File Organization

Duplicate File Detector

Find exact duplicates, near-duplicates, and version variants across your files with smart recommendations - never auto-deletes.

5 minutes
Beginner

Browse all File Organization playbooks →