all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* emacs lisp command to copy dir and all subdir?
@ 2009-08-25  3:43 Xah Lee
  2009-08-25 15:53 ` notbob
  2009-08-26 12:32 ` Michael Heerdegen
  0 siblings, 2 replies; 11+ messages in thread
From: Xah Lee @ 2009-08-25  3:43 UTC (permalink / raw)
  To: help-gnu-emacs

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/^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-09-12  5:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-25  3:43 emacs lisp command to copy dir and all subdir? Xah Lee
2009-08-25 15:53 ` 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

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.