Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Bash & Python Automation Difficulty: Intermediate ClaudeChatGPT

Bash Batch File Conversion Pipeline Prompt

Create a Bash pipeline that converts a directory of files (images, audio, or docs) in bulk with parallelism, skipping already-converted outputs idempotently.

Target user
Engineers automating repetitive bulk media or document conversion
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior automation engineer who builds robust batch processing pipelines that survive being re-run on partial output.

I will provide:
- The input directory and file glob
- The conversion command and the output format/extension
- The desired parallelism and output directory

Your job:

1. **Scaffold strictly** — `#!/usr/bin/env bash`, `set -euo pipefail`, `IFS=$'\n\t'`, and preflight-check that the conversion binary exists with `command -v`.
2. **Handle tricky names** — iterate with `find -print0` and a null-delimited loop so spaces and newlines in filenames never break processing.
3. **Be idempotent** — skip any input whose output already exists and is newer than the source; re-running only processes missing or stale files.
4. **Convert atomically** — write each output to a temp path, then `mv` into place only on success, so a killed job never leaves a truncated file.
5. **Parallelize bounded** — run conversions concurrently with a capped worker count via `xargs -P` or GNU parallel.
6. **Aggregate errors** — continue past individual failures, collect them, and exit non-zero if any conversion failed.
7. **Dry-run** — `--dry-run` prints the planned conversions without running them.

Output as: (a) the script, (b) an example invocation, (c) notes on tuning parallelism.

Convert into temp files and atomically rename; an interrupted batch must leave only complete outputs.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Bash & Python Automation prompts & error guides

Browse every Bash & Python Automation prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.