changeset 105352:f92b20f3ef80

* net/tramp-fish.el (tramp-fish-handle-delete-directory): Handle optional parameter RECURSIVE.
author Michael Albinus <michael.albinus@gmx.de>
date Thu, 01 Oct 2009 15:35:35 +0000
parents 4eaec3ddca1c
children 4f1a9f151253
files lisp/net/tramp-fish.el
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/tramp-fish.el	Thu Oct 01 15:34:56 2009 +0000
+++ b/lisp/net/tramp-fish.el	Thu Oct 01 15:35:35 2009 +0000
@@ -312,10 +312,19 @@
   (tramp-fish-do-copy-or-rename-file
    'copy filename newname ok-if-already-exists keep-date preserve-uid-gid))
 
-(defun tramp-fish-handle-delete-directory (directory)
+(defun tramp-fish-handle-delete-directory (directory &optional recursive)
   "Like `delete-directory' for Tramp files."
   (when (file-exists-p directory)
-    (with-parsed-tramp-file-name
+    (if recursive
+	(mapc
+	 (lambda (file)
+	   (if (file-directory-p file)
+	       (delete-directory file recursive)
+	     (delete-file file)))
+	 ;; We do not want to delete "." and "..".
+	 (directory-files
+	  directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
+     (with-parsed-tramp-file-name
 	(directory-file-name (expand-file-name directory)) nil
       (tramp-flush-directory-property v localname)
       (tramp-fish-send-command-and-check v (format "#RMD %s" localname)))))