# HG changeset patch # User Richard M. Stallman # Date 1116517321 0 # Node ID 95e7ae46e47569ea11fba079d8b97f1b7e95bd24 # Parent 91bf7b558b826f0eeb806174467916ab0945ca1a (dired-copy-file-recursive): Handle symlinks in recursive copy. diff -r 91bf7b558b82 -r 95e7ae46e475 lisp/dired-aux.el --- a/lisp/dired-aux.el Thu May 19 15:40:37 2005 +0000 +++ b/lisp/dired-aux.el Thu May 19 15:42:01 2005 +0000 @@ -1135,23 +1135,29 @@ (defun dired-copy-file-recursive (from to ok-flag &optional preserve-time top recursive) - (if (and recursive - (eq t (car (file-attributes from))) ; A directory, no symbolic link. - (or (eq recursive 'always) - (yes-or-no-p (format "Recursive copies of %s " from)))) - (let ((files (directory-files from nil dired-re-no-dot))) - (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask any more. - (if (file-exists-p to) - (or top (dired-handle-overwrite to)) - (make-directory to)) - (while files - (dired-copy-file-recursive - (expand-file-name (car files) from) - (expand-file-name (car files) to) - ok-flag preserve-time nil recursive) - (setq files (cdr files)))) - (or top (dired-handle-overwrite to)) ; Just a file. - (copy-file from to ok-flag dired-copy-preserve-time))) + (let ((attrs (file-attributes from))) + (if (and recursive + (eq t (car attrs)) + (or (eq recursive 'always) + (yes-or-no-p (format "Recursive copies of %s " from)))) + ;; This is a directory. + (let ((files (directory-files from nil dired-re-no-dot))) + (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask any more. + (if (file-exists-p to) + (or top (dired-handle-overwrite to)) + (make-directory to)) + (while files + (dired-copy-file-recursive + (expand-file-name (car files) from) + (expand-file-name (car files) to) + ok-flag preserve-time nil recursive) + (setq files (cdr files)))) + ;; Not a directory. + (or top (dired-handle-overwrite to)) + (if (stringp (car attrs)) + ;; It is a symlink + (make-symbolic-link (car attrs) to ok-flag) + (copy-file from to ok-flag dired-copy-preserve-time))))) ;;;###autoload (defun dired-rename-file (file newname ok-if-already-exists)