From: Xah Lee <xahlee@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: emacs lisp command to copy dir and all subdir?
Date: Mon, 24 Aug 2009 20:43:38 -0700 (PDT) [thread overview]
Message-ID: <9eca862e-3e82-4a51-b92b-6ddbe867c188@p10g2000prm.googlegroups.com> (raw)
is there a emacs lisp command to copy a whole dir? like unix's cp -R?
i started to write one:
(defun copy-dir (sourcedir destdir)
"Copy all files from SOURCEDIR to DESTDIR.
The input dir should not end in a slash.
Example usage:
(copy-dir
\"/Users/xah/web/p/um\"
\"/Users/xah/web/diklo/xx\")
Note: no consideration is taken about links, alias, or file perms."
(mapc
(lambda (x)
(let ()
(when (and (not (string-equal x ".")) (not (string-equal x
"..")))
(copy-file
(concat sourcedir "/" x) destdir) ) ) )
(directory-files sourcedir) ) )
but it is hackish because of the checking with “.” and “..”,
but also realized this doesn't do sub dirs. In order to do subdir,
it'll prob end up with few hours more...
so, am wondering if there's a pre-made solutions?
Thanks.
Xah
∑ http://xahlee.org/
☄
next reply other threads:[~2009-08-25 3:43 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-25 3:43 Xah Lee [this message]
2009-08-25 15:53 ` emacs lisp command to copy dir and all subdir? notbob
2009-08-26 12:32 ` Michael Heerdegen
2009-08-27 15:21 ` Xah Lee
2009-08-28 20:25 ` John A Pershing Jr
2009-09-10 20:23 ` wart
2009-09-11 14:16 ` Andreas Politz
[not found] ` <mailman.6442.1252678615.2239.help-gnu-emacs@gnu.org>
2009-09-11 17:54 ` Xah Lee
2009-09-12 1:40 ` Xah Lee
2009-09-12 1:43 ` Xah Lee
2009-09-12 5:24 ` Xah Lee
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9eca862e-3e82-4a51-b92b-6ddbe867c188@p10g2000prm.googlegroups.com \
--to=xahlee@gmail.com \
--cc=help-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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.