← Back to Blog

Guide · Feb 2026 · 4 min read

How to Batch Convert Files from the Command Line

Convert hundreds of files in seconds with parallel processing, smart presets, and automatic folder watching. Here's a practical guide to CLI file conversion with ConvX.

Why batch convert from the CLI?

Dragging files one at a time into a converter works for 5 files. It doesn't work for 500. The command line lets you convert entire directories with a single command, run multiple conversions in parallel, and script your workflows for repeatable results.

Basic batch conversion

Convert every PNG in a folder to WebP:

convx convert "./images/*.png" --to webp -d ./output

ConvX expands the glob pattern, converts each file, and saves results to the output directory. File names are preserved with the new extension.

Parallel processing

By default, ConvX converts files sequentially. For large batches, use the -j flag to run multiple conversions in parallel:

convx convert "./photos/*.heic" --to jpg -j 8 -d ./converted

This runs 8 conversions simultaneously. On a modern machine with 8+ cores, this can be 6-8x faster than sequential processing. ConvX handles the job queue automatically.

Using presets

Presets apply the right format, quality, dimensions, and size constraints for a specific use case. Instead of remembering that Discord wants under 8MB at a reasonable CRF with specific dimensions, just use:

convx convert "./clips/*.mov" --preset discord -j 4 -d ./for-discord

All 14 built-in presets work with batch conversion. See convx presets list for the full list.

Size-constrained batch conversion

Need every file under a specific size? ConvX iteratively adjusts quality to hit your target:

convx convert "./videos/*.mp4" --to mp4 --max-size 8388608 -j 4 -d ./compressed

Each file will be under 8MB regardless of the input size. ConvX runs multiple encoding passes per file, tightening quality until the target is met.

Overwriting existing files

By default, ConvX skips files that already exist in the output directory. To overwrite:

convx convert "./images/*.png" --to webp --overwrite -d ./output

Watch mode: continuous batch processing

Instead of running a command every time new files arrive, set up watch mode to auto-convert on file drop:

convx watch ~/Screenshots --to webp --filter "*.png" -q 80

This monitors the folder and converts new files as they appear. It runs until you stop it with Ctrl+C. Useful for workflows where files arrive continuously: AirDrop from your phone, screenshot tools, download folders.

Combining with other CLI tools

ConvX supports --json output for scripting. Pipe results to jq, log to a file, or integrate into shell scripts:

# Convert and log results as JSON
convx --json convert "./images/*.png" --to webp > results.json

# Check available conversions for a format
convx --json formats --from pdf | jq '.targets'

Performance tips

  • Match jobs to CPU cores: Use -j equal to your core count for CPU-bound conversions (images, documents). For video, 2-4 jobs is usually optimal since FFmpeg already uses multiple cores per file.
  • Use presets: They're tuned for quality-to-size ratio. Manual settings often produce larger files at the same visual quality.
  • Convert to WebP for images: 25-35% smaller than JPEG at the same quality, with transparency support.
  • Use watch mode instead of cron: Watch mode is event-driven and converts immediately on file creation, rather than polling on an interval.
ConvX handles batch conversion across 46 formats with 400+ conversion paths. Images, video, audio, documents, data, and eBooks. $20 lifetime. Get ConvX →