is it possible to use rm to remove files and directories matching a pattern recursively without using other commands?
To directly answer your question, "no - you can't do what you describe with
You can, however, do it you combine it with
For example, if you want to nuke all *~ files, you could so this:
To expand from a comment*:
|show 8 more comments|
Using Bash, with
Try it with e.g.
You set options through e.g.
Alternatively, a shorter
or for GNU
or another alternative for non-GNU
To also remove directories, as you ask for: just change
I would have asuumed " rm -rf " where is a combination of file names, and matching patterns such as * and ? etc (eg todays_log_2009????.log) . That will start from current Dir and work down recursively removing files that macth that pattern.