开发者

emacs delete directory recursively?

开发者 https://www.devze.com 2023-01-02 05:06 出处:网络
I was searching through for a way to copy/delete directory trees... dired seems to have dired-copy-file-recursive (though sans documentation) and a search on \'recursive\' also retu开发者_JS百科rns:

I was searching through for a way to copy/delete directory trees... dired seems to have dired-copy-file-recursive (though sans documentation) and a search on 'recursive' also retu开发者_JS百科rns:

tramp-handle-dired-recursive-delete-directory is a compiled Lisp
function in `tramp.el'.

(tramp-handle-dired-recursive-delete-directory FILENAME)

Recursively delete the directory given.
This is like `dired-recursive-delete-directory' for Tramp files.

But I can't find dired-recursive-delete-directory anywhere! Anyone know what's going on? Thanks ~

Edit Thanks all for the responses. The computer I have has 23.1 installed (it's in a remote location with no internet so installations/upgrades are a pain) but I did find dired-delete-file has a recursive option that accomplishes this task (had to activate with (require 'dired)). I look forward to upgrading to 23.2 on my personal machine though!


You might want to have a look at this section of the Emacs Lisp manual. This refers to the latest stable Emacs version(23.2). It's always a good idea to use it (if possible) anyway.


In Emacs 23.2 the following are available (I copy from Emacs 23.2 news)

  • Changes to file-manipulation functions

  • `delete-directory' has an optional parameter RECURSIVE.

  • New function `copy-directory', which copies a directory recursively.

For complete documentation you can check the Emacs Lisp Reference but of course C-h f is always your friend.


This will let you mark directories for recursive deletion in dired:

(setq dired-recursive-deletes 'top)

Dired will prompt for confirmation.

0

精彩评论

暂无评论...
验证码 换一张
取 消