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.
Note: no consideration is taken about links, alias, or file perms."
(when (and (not (string-equal x ".")) (not (string-equal x "..")))
(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 might end up with few hours more...
so, am wondering if there's a pre-made solutions?
On Aug 26, 5:32 am, Michael Heerdegen
> Have a look at the doc of `dired-recursive-copies'.
sorry all, but a bit clarification.
i needed a copy-dir function for elisp coding, not as user function in dired.
i haven't thought about looking into how dired-do-copy implement it, good thought. thanks.
looking into it, it seems a bit complex:
(defun dired-do-copy (&optional arg)
"Copy all marked (or next ARG) files, or copy the current file.
This normally preserves the last-modified date when copying.
When operating on just the current file, you specify the new name.
When operating on multiple or marked files, you specify a directory,
and new copies of these files are made in that directory
with the same names that the files currently have. The default
suggested for the target directory depends on the value of
`dired-dwim-target', which see.
This command copies symbolic links by creating new ones,
like `cp -d'."
(let ((dired-recursive-copies dired-recursive-copies))
(dired-do-create-files 'copy (function dired-copy-file)
is this the only way?
i think most modern scripting lang has a copy dir function... that'd be good in elisp.
for solution, see:
• Emacs Lisp Suggestion: A Function For Copying and Deleting Whole Dir