emacs-devel
[Top][All Lists]
Advanced

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

Re: copy-directory


From: Eli Zaretskii
Subject: Re: copy-directory
Date: Sun, 04 Oct 2009 15:07:35 +0200

> From: Michael Albinus <address@hidden>
> Date: Sun, 04 Oct 2009 14:30:00 +0200
> 
> I've added `copy-directory' to files.el, which copies directories
> recursively. It is also used by `dired-copy-file-recursive'.
> 
> I have tested it with GNU/Linux (Ubuntu 9.04). It would be nice, if
> people could care about on other systems, I have no access to.

Please don't rely on the `chown' command being available for the
preserve-uid-gid option.  It is only available on Posix platforms.
Instead, please add a primitive to do this from within Emacs.

And one more comment about the code:

      (mapc
       (lambda (file)
         (if (file-directory-p file)
             (copy-directory file newname keep-time preserve-uid-gid parents)
           (copy-file file newname t keep-time preserve-uid-gid)))
       ;; We do not want to delete "." and "..".
       (directory-files
        directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*"))

Instead of this complicated regexp, isn't it easier to just filter out
"." and ".." by adding a suitable comparison to the function you map
of the files?  I find it not easy to convince myself that the regexp
indeed matches every valid file name but those two.




reply via email to

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