12

Use-case:

  1. Mark for deletion target files and directories at the dired buffer;
  2. Execute 'dired-do-flagged-delete' (type 'x');

Result: I'm asked about confirmation for every non-empty directory being removed.

Question: is there easy way to say 'yes' one time and get all of the marked stuff (including non-empty directories) removed?

I googled that it's possible to set 'dired-recursive-deletes' to 'always' but that doesn't protect me from accidental 'delete' processing (e.g. mistyped 'x' while wrong directory is marked).

I understand that it's possible to customize emacs via lisp injections but I don't know that language so far, that's the reason why I'm asking whether there is other solution.

denis.zhdanov
  • 3,734
  • 20
  • 25
  • When you press `x`, you are prompted whether or not to delete all the marked files. With the `top` setting (default), you're prompted for each directory individually, and with the `always` setting you're not prompted (other than the initial prompt). Are you asking for two prompts - the initial one, which lists everything, and a second prompt which only lists the directories? – Trey Jackson Jun 21 '11 at 18:43
  • I'm asking about single confirmation for 'delete all'. – denis.zhdanov Jun 22 '11 at 12:12

1 Answers1

18

I think you found your answer but didn't try it.

(setq dired-recursive-deletes 'always)

And you'll only get a single prompt, asking if you want to delete the n items, and you'll get a list of them. You will not be further prompted for the directories.

Trey Jackson
  • 73,529
  • 11
  • 197
  • 229