Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dired: One confirmation for all selected files and directories

Tags:

emacs

dired

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.

like image 316
denis.zhdanov Avatar asked Jun 21 '11 15:06

denis.zhdanov


1 Answers

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.

like image 162
Trey Jackson Avatar answered Oct 06 '22 13:10

Trey Jackson