A powerful, optimized command-line tool for running other command-line programs recursively on all files in a folder. Built with Rust and Clap.
✨ Recursive Processing - Process all files in a directory tree
🎯 File Filtering - Filter by file extension
📁 Flexible Output - Control output location and file extensions
🎨 Colorful Output - Clear, beautiful terminal output
⚡ Optimized - Fast and memory-efficient
🛡️ Safe - Proper error handling with no panics
🔄 Error Control - Stop on first error or continue processing
🔧 Argument Templating - Full control over child process arguments
📝 Smart File Handling - Skip, overwrite, or rename when files exist
cargo build --releaseThe binary will be available at target/release/cmdlooper.exe
Process all files with a specific extension using a simple command:
cmdlooper --command my_tool --extension datThis will execute my_tool <input_file> <output_file> for each .dat file found.
cmdlooper --command file_converter \
--input ./source_files \
--output ./converted \
--extension dat \
--output-extension out \
--args --quality high {input} {output}This processes all .dat files and converts them to .out format in a different directory.
cmdlooper --command processor \
--input ./input_data \
--output ./output_data \
--extension src \
--output-extension dst \
--args -i {input} -o {output} --flag1 --flag2 value \
--continue-on-error \
--verbosecmdlooper --command custom_tool \
--input ./data \
--extension raw \
--output-extension processed \
--args -i {input} -o {output} --option valuecmdlooper --command optimizer \
--input ./data \
--extension txt \
--args --input {input} --output {output}Process multiple file types in a single run:
cmdlooper --command processor \
--input ./data \
--extension txt --extension dat --extension cfg \
--output-extension processed \
--args -i {input} -o {output}
# Or using short form:
cmdlooper -c processor -i ./data -e txt -e dat -e cfg -x processedThis will process all .txt, .dat, and .cfg files in the data directory.
# Skip existing files (default)
cmdlooper --command file_processor \
--input ./data \
--output-extension out \
--if-exists skip
# Overwrite existing files
cmdlooper --command file_processor \
--input ./data \
--output-extension out \
--if-exists overwrite
# Rename new files (appends _1, _2, etc.)
cmdlooper --command file_processor \
--input ./data \
--output-extension out \
--if-exists rename| Option | Short | Description |
|---|---|---|
--command |
-c |
Required. Command to execute for each file |
--input |
-i |
Input folder to process (default: current directory) |
--output |
-o |
Output folder (default: same location as input files) |
--extension |
-e |
File extension(s) to filter (e.g., "dat", "txt"). Can specify multiple times |
--output-extension |
-x |
Output file extension (e.g., "out", "processed") |
--args |
-a |
Additional arguments to pass to the command |
--continue-on-error |
Continue processing even if a file fails | |
--if-exists |
Action when output file exists: skip, overwrite, or rename (default: skip) |
|
--input-placeholder |
Placeholder for input file in args (default: {input}) |
|
--output-placeholder |
Placeholder for output file in args (default: {output}) |
|
--verbose |
-v |
Enable verbose output |
--help |
-h |
Print help information |
The tool supports flexible argument templating using placeholders:
{input}- Replaced with the input file path{output}- Replaced with the output file path
If you don't specify --args, the tool automatically passes the input and output files:
cmdlooper --command my_tool --extension txt
# Executes: my_tool input.txt output.txtSpecify custom arguments with placeholders:
cmdlooper --command my_tool \
--extension txt \
--args -i {input} -o {output} --quality high
# Executes: my_tool -i input.txt -o output.txt --quality highThe tool provides colorful, informative output:
- ⚙ Blue gear icon for processing files
- ✓ Green checkmark for successful operations
- ⊝ Yellow circle for skipped files (already exist)
- ✗ Red X for failed operations
- Summary statistics at the end
By default, the tool stops on the first error. Use --continue-on-error to process all files regardless of errors:
cmdlooper --command my_tool \
--extension dat \
--continue-on-errorControl what happens when an output file already exists using the --if-exists option:
Skips files that already exist and continues to the next file. Skipped files are tracked separately in the summary.
cmdlooper --command processor --extension dat --if-exists skipOverwrites existing output files without warning.
cmdlooper --command processor --extension dat --if-exists overwriteAutomatically renames the new file by appending a number (_1, _2, etc.) to avoid conflicts.
cmdlooper --command processor --extension dat --if-exists rename
# Creates: output.dat, output_1.dat, output_2.dat, etc.- Zero-copy processing where possible
- Efficient directory traversal using walkdir crate
- Minimal allocations for optimal performance
- No panics - all errors are handled gracefully
# Debug build
cargo build
# Optimized release build
cargo build --release
# Run tests (if any)
cargo testclap- Command-line argument parsingwalkdir- Recursive directory traversalcolored- Terminal color outputanyhow- Error handling
This project is provided as-is for your use.
- Image Processing: ImageMagick, various image converters
- Video Encoding: FFmpeg, HandBrake CLI
- Audio Processing: Sox, audio converters
- Document Conversion: Pandoc, document processors
- Data Processing: Custom data transformers, formatters
- Compression: 7zip, compression utilities
- Code Generators: Template processors, code generators
- Custom Scripts: Any executable that takes input/output files
Ensure the command you're running is in your PATH or provide the full path:
cmdlooper --command "C:\Program Files\MyTool\tool.exe" --extension datMake sure you have write permissions for the output directory.
Check that:
- The input directory exists
- The file extension filter matches your files
- Use
--verboseflag to see more details