Reuben Thomas wrote:
I just had a situation where this would have been useful. I tried -v
--ignore-fail-on-non-empty, but of course it told me about every directory
it processed, which is fine, but not what I wanted.
How about this?
$ mkdir -p 1/2/3 11
$ rmdir -v 1
rmdir: removing directory, 1
rmdir: 1: Directory not empty
$ echo $?
1
And this does not seem like the type of thing that needs to be
optimized for keyboard use but sounds more like something in a script.
In which case a little more verbose is okay. That leads me to this:
for dir in *; do
rmdir $dir && echo removed: $dir # or whatever you want to do here
done