bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#4416: 23.1; suggestion: a elisp function for copying and deleting wh


From: Xah Lee
Subject: bug#4416: 23.1; suggestion: a elisp function for copying and deleting whole dir
Date: Fri, 11 Sep 2009 22:21:00 -0700

here's my draft implementation. (thanks to Andreas Politz who pointed out the dired-aux function)

(defun copy-directory-recursive (source-dir dest-dir)
 "Copy whole a directory SOURCE-DIR to DEST-DIR.
Note, the semantics of source-dir dest-dir is different from the unix “cp” utility. In unix's “cp -R”, if dest-dir exists, it'll copy source-dir itself, else, just source-dir's children.

In copy-directory-recursive, it always copy source-dir's children.

In both, the dest-dir may or may not exist. If not, it'll be created. However, dest-dir's parent must exist.

This function is based on dired-copy-file-recursive.
Behavior about linked files, etc, are from that function."
 (require 'dired-aux)
 (dired-copy-file-recursive source-dir dest-dir nil nil nil 'always)
 )

haven't worked on delete-directory-recursive yet...

 Xah
∑ http://xahlee.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]