Instead of doing something like find . -type d -execdir ... \; you can run redo with the command you want to have executed recursively in the subdirectories of the working directory.
If Homebrew is installed, you can run this command:
brew install vbwx/utils/redo- Download and extract the latest release of redo.
- If desired, move the completion script(s) to the appropriate location on your system.
- Move
completion/redoto a directory like/etc/bash_completion.d. - Move
completion/_redoto a directory like/usr/share/zsh/site-functions.
- Move
- Move
redoto a directory such as/usr/bin.
Run redo --help to get a quick overview of how to use this utility.
redo [--quiet] [--strict] [--follow] [--hidden] [--nocd]
[--mindepth N | +N] [--maxdepth N | -N] [--depth N | --N]
[--] [+INCLUDE_GLOB ...] [-EXCLUDE_GLOB ...]
[+] [DIR ...] [-] [SCRIPT_OR_EXECUTABLE [ARG ...]]
You can use the following variables in the script supplied to redo.
DIR: stringCWD: string (empty if--nocdis specified)ROOT: stringCOUNT: integerINDEX: integerRCOUNT: integerRINDEX: integerDEPTH: integerRUNS: integerFILES: integerSUBDIRS: integerLEAF: empty string or 1
redo echo \$CWD
redo --nocd echo \$DIR # same result
redo echo \$PWD # absolute pathsredo --depth 2 --hidden -.git 'echo $INDEX: $DIR'
redo --2 --hidden -.git echo \$INDEX: \$DIR # same resultredo <<< 'echo "($DEPTH) $INDEX/$COUNT: $CWD"'redo echo '"$CWD ($SUBDIRS directories, $FILES files)"'redo --mindepth=2 --maxdepth=3 echo \$CWD
redo +2 -3 'echo $CWD' # same resultredo --quiet SetFile -a E '*.*' # executed in subdirectories recursively
redo --quiet . SetFile -a E '*.*' # also executed in working directory