Preparing for system design interviews?  Try bugzed.com →

foreach-cli: Execute Command Per File

JSON →
library 1.8.1 ·javascript
verified Jun 17, 2026

foreach-cli is a command-line utility designed to execute a specified shell command for each file that matches a given glob pattern. Currently at version 1.8.1, the package provides a stable and reliable method for batch processing files. It differentiates itself from its predecessor, `each-cli`, by consistently setting the current working directory (CWD) to where `foreach-cli` was invoked, rather than changing it to the matched file's directory. This design choice simplifies command construction and prevents unexpected path issues. Additionally, it accepts command arguments as direct strings, enabling complex shell commands, including piping and redirects, that might be problematic with other tools. The utility supports various placeholders like `#{path}`, `#{dir}`, and `#{name}` to dynamically inject file-specific information into the executed commands.

total hits 14
actors 3 distinct systems
last hit 20d ago AhrefsBot
GPTBot
4
Script
1
Humans
5

top countries 🇨🇦 Canada · 🇺🇸 United States · 🇨🇳 China · 🇸🇬 Singapore · 🇩🇪 Germany