each-cli
v0.0.2
Published
CLI utility to execute a command for each glob matching file
Downloads
10
Readme
each-cli
CLI utility to execute a command for each glob matching file.
Examples:
Visit each .tar file (setting the directory to its location) and untar:
each '**/*.tar' -- tar xvf %fConvert all .jpg images to .png
each '**/*.jpg' -- convert %b.jpg %b.pngSee the main --help page for more information.
Installation
npm install -g each-cliCommand expansion
Commands can be written in a varity of ways. Each of the below tokens gets expanded into the value shown.
| Token | Example | Description |
|----------------|----------------------------|----------------------------------|
| %f | myfile.foo | File name |
| %p | /foo/bar/baz/myfile.foo | File path |
| %b | myfile | File name without extension |
| %e | foo | File extension |
| {{name}} | myfile.foo | File name |
| {{path}} | /foo/bar/baz/myfile.foo | File path |
| {{dir}} | /foo/bar/baz | The dir portion of the full path |
| {{base}} | myfile | File name without extension |
| {{basename}} | myfile | File name without extension |
| {{ext}} | foo | File extension |
