By default, dired only deletes empty directories. You know the drill. Put your point on the directory, D, y (yes), “file-error Removing directory directory not empty,” (slam fist on table). Doh!
Fortunately, dired supports deleting directories recursively. Add this to your .emacs:
(setq dired-recursive-deletes 'top)
The dired-recursive-deletes variable decides whether recursive deletes are allowed. This particular setting will prompt with confirmation for each directory at the top level but delete all subdirectories without asking. Other possible values include:
nilmeans no recursive deletes. (default)'topmeans ask for each directory at the top level but delete subdirectories without asking.'alwaysmeans delete recursively without asking. Warning: The Surgeon General has determined that this may be hazardous to your health.
- Anything else means ask for each directory (including subdirectories).
As always, C-h v dired-recursive-deletes for the full low-down.
3 responses so far ↓
OMG! thanks
Thanks!!
I was looking for a solution to ‘file-error’ right now (after carefully choosing a long list of files and directories…), and I found yours in less than a second!
Thanks a lot!
Leave a Comment