How to delete backup emacs files recursively?

In emacs, in Dired mode, I can use the ~ command to mark all my emacs backups for deletion. Is there a way to mark everything recursively so that I can delete all my backups in the current directory and in all subdirectories?

+4
source share
3 answers

You can define two types of dired: flat and recursive. For instance:

(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 "Cx Cd") 'op-i:dired) 

Then the call of this function with Cu Cx Cd will be displayed recursively, and with Cx Cd will be executed as usual.

After displaying recursive recursively, you can also delete backups or do other things recursively.

+2
source

You can also use Mx find-name-dired with the file template *~ to list only backup files in the buffer with the buffer.

+1
source

If you are using * nix or cygwin , you should be able to do

 find -name '*~' -exec rm {} \; 
+1
source

Source: https://habr.com/ru/post/1395465/


All Articles