2009-08-25

emacs: deleting dir and all sub dir

On Aug 25, 1:37 am, Alain Muls wrote:
> Hi emacs users
>
> I installed trashcan.el and this works fine for deleteing files from
> dired, but deleting a directory (recursively) cannot be done. Is there a
> way around?

to delete dir, you need to set a built-in var.

Q: How to delete or copy a entire directory

A: Type “Alt+x customize-variable” then “dired-recursive-deletes”, then click on the Value Menu to make a choice. Then, click “Save for Future Sessions”, then “Finish”. Do the same with variable “dired-recursive-copies”.

;; allow dired to be able to delete or copy a whole dir.
(setq dired-recursive-copies (quote always))
(setq dired-recursive-deletes (quote top))
;; “always” means no asking.
;; “top” means ask once (top = top dir).
;; any other symbol means ask for each dir or subdir.

• File Management with Emacs
http://xahlee.org/emacs/file_management.html

-----------------------------------

if you are running emacs 23, deleting trash is already part of it.

Deleting files in emacs can now be set so that they move to the OS's trash.

; deleting files goes to OS's trash can
(setq delete-by-moving-to-trash t) ; “t” for true, “nil” for false

However, this feature has a few problems. When this is on, your system trash will be filled with tens or hundreds of emacs temp files, such as those “#autosave#” files, “backup~” files, “.emacs.desktop”, “emacs00164”, “server”, etc. Also, when deleting a directory from dired, your system trash will end up with each individual files, instead of just a folder. If the folder has few hundred files, the process will be super slow. This happens at least on Windows emacs.

• New Features in Emacs 23
http://xahlee.org/emacs/emacs23_features.html

Xah
∑ http://xahlee.org/

No comments:

Post a Comment