diff options
| author | Richard M. Stallman | 2005-05-19 15:42:01 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-05-19 15:42:01 +0000 |
| commit | 3b68c5062f4158dab9fb503ff352d1d342ec374b (patch) | |
| tree | b54691f9c82367ef354caabd608c13179130e1a9 | |
| parent | b4aefb19b7176c198d19f27285367486bb13271a (diff) | |
| download | emacs-3b68c5062f4158dab9fb503ff352d1d342ec374b.tar.gz emacs-3b68c5062f4158dab9fb503ff352d1d342ec374b.zip | |
(dired-copy-file-recursive): Handle symlinks in recursive copy.
| -rw-r--r-- | lisp/dired-aux.el | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 66150968e61..eec3045b53a 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el | |||
| @@ -1135,23 +1135,29 @@ Special value `always' suppresses confirmation." | |||
| 1135 | 1135 | ||
| 1136 | (defun dired-copy-file-recursive (from to ok-flag &optional | 1136 | (defun dired-copy-file-recursive (from to ok-flag &optional |
| 1137 | preserve-time top recursive) | 1137 | preserve-time top recursive) |
| 1138 | (if (and recursive | 1138 | (let ((attrs (file-attributes from))) |
| 1139 | (eq t (car (file-attributes from))) ; A directory, no symbolic link. | 1139 | (if (and recursive |
| 1140 | (or (eq recursive 'always) | 1140 | (eq t (car attrs)) |
| 1141 | (yes-or-no-p (format "Recursive copies of %s " from)))) | 1141 | (or (eq recursive 'always) |
| 1142 | (let ((files (directory-files from nil dired-re-no-dot))) | 1142 | (yes-or-no-p (format "Recursive copies of %s " from)))) |
| 1143 | (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask any more. | 1143 | ;; This is a directory. |
| 1144 | (if (file-exists-p to) | 1144 | (let ((files (directory-files from nil dired-re-no-dot))) |
| 1145 | (or top (dired-handle-overwrite to)) | 1145 | (if (eq recursive 'top) (setq recursive 'always)) ; Don't ask any more. |
| 1146 | (make-directory to)) | 1146 | (if (file-exists-p to) |
| 1147 | (while files | 1147 | (or top (dired-handle-overwrite to)) |
| 1148 | (dired-copy-file-recursive | 1148 | (make-directory to)) |
| 1149 | (expand-file-name (car files) from) | 1149 | (while files |
| 1150 | (expand-file-name (car files) to) | 1150 | (dired-copy-file-recursive |
| 1151 | ok-flag preserve-time nil recursive) | 1151 | (expand-file-name (car files) from) |
| 1152 | (setq files (cdr files)))) | 1152 | (expand-file-name (car files) to) |
| 1153 | (or top (dired-handle-overwrite to)) ; Just a file. | 1153 | ok-flag preserve-time nil recursive) |
| 1154 | (copy-file from to ok-flag dired-copy-preserve-time))) | 1154 | (setq files (cdr files)))) |
| 1155 | ;; Not a directory. | ||
| 1156 | (or top (dired-handle-overwrite to)) | ||
| 1157 | (if (stringp (car attrs)) | ||
| 1158 | ;; It is a symlink | ||
| 1159 | (make-symbolic-link (car attrs) to ok-flag) | ||
| 1160 | (copy-file from to ok-flag dired-copy-preserve-time))))) | ||
| 1155 | 1161 | ||
| 1156 | ;;;###autoload | 1162 | ;;;###autoload |
| 1157 | (defun dired-rename-file (file newname ok-if-already-exists) | 1163 | (defun dired-rename-file (file newname ok-if-already-exists) |