Group directories and sequentially run shell operation on all group members.
Below instuction assumes that you have ~/bin
directory which is added to your
PATH
environment variable.
wget https://raw.githubusercontent.com/mchalapuk/folders/master/folders.sh -O ~/bin/folders
chmod +x ~/bin/folders
Usage: folders <command> [arguments...]
Commands:
list - lists folders added to the group
add [folders...] - adds specified folders to the group
del [folders...] - deletes specified folders from the group
run <command-line> - runs specified command on all added folders
usage - shows this message
Options:
--clean (-c) - displays only stdout and stderr from child processes
In order to create a group, just link the script into another file.
cd ~/bin
ln -s folders all-repos
New group is used when running the script via all-repos
symlink.
all-repos add ~/code/*
all-repos run git checkout master
all-repos run git pull
Above code:
- Adds all folders from
~/code/
directory to the group, - Runs
git checkout master
command on all folders, - Runs
git pull
command on all folders.
© 2017 Maciej Chałapuk. Released under MIT License.