Reputation:
In emacs, while in Dired mode, I can use the ~ command to mark all my emacs backups for deletion. Is there a way to mark them all recursively so I can delete all my backups in the current directory and all subdirectories?
Upvotes: 6
Views: 883
Reputation: 14065
If you're on a *nix or cygwin, you should be able to do
find -name '*~' -exec rm {} \;
Upvotes: 3
Reputation: 73274
You could also use M-x find-name-dired
with file pattern *~
to list only the backup files in a dired buffer.
Upvotes: 1
Reputation: 21172
You can define two kinds of dired: flat and recursive. For example:
(defun op-i:dired (rec)
"customized dired: will display directory recursively when called with an argument"
(interactive "P")
(let ((dir (car (find-file-read-args "Dired: " nil)))
(opts (if rec (read-string "options: " "-lhAR") "-lhA")))
(if (file-directory-p dir) (dired dir opts))))
(define-key (current-global-map) (kbd "C-x C-d") 'op-i:dired)
Then calling this function with C-u C-x C-d
will display dired recursively and with C-x C-d
will do it as usual.
After displaying dired recursively you can delete backups or do other stuff recursively too.
Upvotes: 2