foreach-cli: Execute Command Per File
JSON →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.
Traffic · last 30 days ↓67% vs prev 7d
top countries 🇺🇸 United States · 🇫🇷 France · 🇨🇦 Canada · VN · 🇩🇪 Germany