changeset 79294:038b3e2f763f

(dired-copy-file-recursive): Preserve directory permissions.
author Juanma Barranquero <lekktu@gmail.com>
date Wed, 31 Oct 2007 18:12:32 +0000
parents 7b9d5ff05014
children 7885b35965a1
files lisp/dired-aux.el
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/dired-aux.el	Wed Oct 31 15:59:19 2007 +0000
+++ b/lisp/dired-aux.el	Wed Oct 31 18:12:32 2007 +0000
@@ -1162,7 +1162,8 @@
 	     (or (eq recursive 'always)
 		 (yes-or-no-p (format "Recursive copies of %s? " from))))
 	;; This is a directory.
-	(let ((files
+	(let ((mode (file-modes from))
+	      (files
 	       (condition-case err
 		   (directory-files from nil dired-re-no-dot)
 		 (file-error
@@ -1176,7 +1177,9 @@
 	    (if (file-exists-p to)
 		(or top (dired-handle-overwrite to))
 	      (condition-case err
-		  (make-directory to)
+		  (progn
+		    (make-directory to)
+		    (set-file-modes to #o700))
 		(file-error
 		 (push (dired-make-relative from)
 		       dired-create-files-failures)
@@ -1195,7 +1198,9 @@
 		(file-error
 		 (push (dired-make-relative thisfrom)
 		       dired-create-files-failures)
-		 (dired-log "Copying error for %s:\n%s\n" thisfrom err))))))
+		 (dired-log "Copying error for %s:\n%s\n" thisfrom err)))))
+	  (when (file-directory-p to)
+	    (set-file-modes to mode)))
       ;; Not a directory.
       (or top (dired-handle-overwrite to))
       (condition-case err
@@ -1203,7 +1208,7 @@
 	      ;; It is a symlink
 	      (make-symbolic-link (car attrs) to ok-flag)
 	    (copy-file from to ok-flag dired-copy-preserve-time))
-	(file-date-error 
+	(file-date-error
 	 (push (dired-make-relative from)
 	       dired-create-files-failures)
 	 (dired-log "Can't set date on %s:\n%s\n" from err))))))