I would like to delete a directory in emacs' dired-mode. I mark the directory with the "d" key, and then hit "x" to deleted flagged. I then get the following error:

file-error Non-regular file is a directory <name of dir>

Is there any way to get emacs to delete the directory and stop its whining?

link|improve this question

64% accept rate
feedback

1 Answer

up vote 2 down vote accepted

I am not sure what emacs version you have, mine gives me this error: (file-error Removing directory Directory not empty ...) For empty directories, it doesn't complain.

Anyway, in the version I have, there is a variable: dired-recursive-deletes that decides if directories can be deleted if they have some content. You should thus customize this variable with:

M-x customize-variable

and then when prompter specify:

dired-recursive-deletes

You can then choose the behaviour by clicking on the "Value Menu" button and then save it with the button at the top of the buffer.

link|improve this answer
In .emacs: (setq dired-recursive-deletes 'top) – oneself Feb 18 '11 at 21:26
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.