in reply to
removing directories with wildcard glob in OS-portable way
It is sometimes better, more-consistent among different OSes, to write code (it can also be a one-liner ...) to iterate through the tree pushing directory-names onto an array, then in step 2 iterate through the accumulated array. Some systems e.g. early Windows have been known to "skip" names in their directory walker when targets disappear, so that at the end of the day not everything's gone. Problem being of course that the list might build up many names that when encountered no longer exist.