batch-convert command processes entire directories of files, converting all files with a specified input extension to a target output format.
Syntax
Parameters
Path to the input directory containing files to convert
Path to the output directory where converted files will be saved (created if it doesn’t exist)
Input file extension to match (e.g.,
.txt or txt)Output file extension for converted files (e.g.,
.pdf or pdf)Usage Examples
Convert Documents Directory
Convert Images to PDF
./photos directory to PDF files in the ./pdfs directory.
Convert Audio Files
Extension Formats
Both formats work for extensions:Use Cases
1. Document Migration
Convert an entire documentation folder from Markdown to PDF:2. Image Optimization
Convert large PNG files to compressed JPG format:3. Media Library Conversion
Convert video files to web-optimized format:4. Archive Format Standardization
Convert all ZIP archives to TAR.GZ:Best Practices
- Test First: Run a test conversion on a single file before processing entire directories
- Separate Output: Always use a different output directory to avoid mixing source and converted files
- Check Dependencies: Ensure required dependencies (LaTeX, FFmpeg, etc.) are installed for your conversion type
- Monitor Progress: Watch the terminal output to identify any failed conversions
- Verify Results: Spot-check converted files to ensure quality meets expectations
Error Handling
If no files match the input extension:Notes
- The output directory is created automatically if it doesn’t exist
- Original files are always preserved (equivalent to
--preserve-originalflag) - Failed conversions don’t stop the batch process
- Output filenames match input filenames with the new extension
- Only files in the root of the input directory are processed (not subdirectories)