I want to delete everything under some directory /path/to/foo, EXCEPT those sub-directories that match the meta-pattern/path/to/foo/<DIGITS>/For example, if the contents under /path/to/foo are initially like this:/path/to/foo 0/  a  b 232532/ 42 73/  d  e 8xyz/  i  j _bar/  x  y  z .baz/  f  frobozz/      g      h quux/     123/...I want to end up with/path/to/foo 0/  a  b 232532/ 73/     d     eI'm looking for a find ... -delete-based incantation, or a suitable zsh glob pattern (for rm -r), that will do this. I am using Linux. 
How to delete everything except top-level numeric directories?
find;zsh;wildcards
With zsh:set -o extendedglob # best in ~/.zshrcrm -rf /path/to/foo/^<->(D) /path/to/foo/<->(^-/)^something is not something (similar to ksh's !(something))<-> is <x-y> to match decimal integers from x to y, but with none of the bounds provided (so matches any sequence of decimal digits, similar to ksh's +([0-9])).(D) a glob qualifier to include hidden files (Dot files)(^-/) a glob qualifier to say only files that are not of type directory after symlink resolution (remove the - if you also want to remove symlinks to directories).