unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Xah Lee" <xah@xahlee.org>
To: <bug-gnu-emacs@gnu.org>
Subject: bug#4416: 23.1; suggestion: a elisp function for copying and deleting whole dir
Date: Fri, 11 Sep 2009 22:21:00 -0700	[thread overview]
Message-ID: <24BBDB8B62A14886882A9A4191E65E14@xahPC> (raw)

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	other threads:[~2009-09-12  5:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-12  5:21 Xah Lee [this message]
2009-09-12 11:56 ` bug#4408: bug#4416: 23.1; suggestion: a elisp function for copying and deleting whole dir Juanma Barranquero
2009-09-12 12:26   ` Xah Lee
2011-10-06  7:08   ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=24BBDB8B62A14886882A9A4191E65E14@xahPC \
    --to=xah@xahlee.org \
    --cc=4416@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).