First, what do you mean by recursively? Recursion is a convenient way to implement dome algorithms, but tends to be overused, but some people also use the term to search the directory tree (which can be implemented in other ways that are recursive). If you just want to delete all files matching a specific glob in the directory tree, then ...
find /base/directory/ -type f -iname '*~' -exec rm -f {}\;
(but first you can experiment with find /base/directory/ -type f -iname '*~' -exec ls -l {}\; ).
symcbean
source share