rm -rf /base-dir-path/*/work isn't the same as /base-dir-path/*/*/work
On tcsh 6.18.00 or newer:
set globstarrm -rf /base-path/path/**/work
On bash 4.0 or newer:
shopt -s globstarrm -rf /base-dir/path/**/work
On ksh:
set -o globstar # or set -Grm -rf /base-dir/path/**/work
On zsh:
rm -rf /base-dir/path/**/work
Alternately, with a find
compliant with the 2006 revision of POSIX:
find /base-dir/path -type d -name work -exec rm -rf -- '{}' +
If you don't have a find
with -exec ... {} +
, then you likely don't have an xargs -0
either, and need to do this the inefficient way to be safe:
find /base-dir/path -type d -name work -exec rm -rf -- '{}' ';'