1.0.4 • Published 10 years ago
frunner v1.0.4
frunner
Running shell commands over files.
Installation
npm install frunner -g
Usage
Usage: frunner <directory1, directory2, ...> [options]
Options:
-h, --help output usage information
-V, --version output the version number
-c, --cmd [value] shell command("##" will be replaced to file path with quotes)
-f, --filter [value] the filter applied when searching files(always enclose filter string with quotes to escape wildcard character in bash)
-r, --replaceText [value] the text which will be replaced to file path [Default: "##"]
Examples
List all subfiles in directory /a/
and /b/
(if no extra option supplied, frunner will only list subfiles):
frunner "/a/" "/b/"
Run a simple echo
shell command over all subfiles in directory /a/
and /b/
, the ##
will be replaced to file path with quotes when running command:
frunner "/a/" "/b/" -c "echo Hello ##"
Append some text to all .txt
files in directory /a/
and /b/
(using -f
option):
Tip: always enclose filter string with quotes to escape wildcard character in bash.
frunner "/a/" "/b/" -c "echo \"--- Copyright (C) Mgen 2015 --- \" >> ##" -f "*.txt"
Batch resizing all .png
, .jpg
, .jpeg
files in directory /a/
and /b/
using ImageMagick's convert
command:
frunner "/a/" "/b/" -c "convert ## -resize 64x64 ##" -f "+(*.png|*.jpg|*.jpeg)"
Filter String
- Filter string should be enclosed with quotes to escape wildcard characters in bash.
- frunner uses node-glob to list and filter files, visit node-glob's homepage if you want more cool features on filter string.