rm -i so that when I mistype
file * I get prompted before accidentally deleting files I didn't intend to delete. Is there an equivalent idiom for directories?
In particular, to delete a directory and its contents, you have to
rm -r. Using
rm -ri will prompt you for all the files in it, not just the top-level directory. For directories with a lot of files, that's not convenient. To avoid that, I frequently use
rm -rf, but that scares me. I'm only a typo away from blowing away lots of important stuff (e.g.
rm -rf ~ /foo instead of
rm -rf ~/foo—ouch!).
One could write a mildly annoying script to replace, e.g., rmdir with something that only prompts for the things listed on the command line, but it seems like this is the kind of problem for which a solution should already exist.