Function: tramp-gvfs-handle-delete-directory

tramp-gvfs-handle-delete-directory is a byte-compiled function defined in tramp-gvfs.el.gz.

Signature

(tramp-gvfs-handle-delete-directory DIRECTORY &optional RECURSIVE TRASH)

Documentation

Like delete-directory for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-gvfs.el.gz
(defun tramp-gvfs-handle-delete-directory (directory &optional recursive trash)
  "Like `delete-directory' for Tramp files."
  (tramp-skeleton-delete-directory directory recursive trash
    (if (and recursive (not (file-symlink-p directory)))
	(mapc (lambda (file)
		(if (eq t (file-attribute-type (file-attributes file)))
		    (delete-directory file recursive)
		  (delete-file file)))
	      (directory-files
	       directory 'full directory-files-no-dot-files-regexp))
      (unless (tramp-compat-directory-empty-p directory)
	(tramp-error
	 v 'file-error "Couldn't delete non-empty %s" directory)))

    (unless (and (tramp-gvfs-send-command
		  v "gvfs-rm" (tramp-gvfs-url-file-name directory))
		 (not (tramp-gvfs-info directory)))
      ;; Propagate the error.
      (with-current-buffer (tramp-get-connection-buffer v)
	(goto-char (point-min))
	(tramp-error-with-buffer
	 nil v 'file-error "Couldn't delete %s" directory)))))