Function: tramp-sh-handle-make-directory

tramp-sh-handle-make-directory is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-sh-handle-make-directory DIR &optional PARENTS)

Documentation

Like make-directory for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-sh-handle-make-directory (dir &optional parents)
  "Like `make-directory' for Tramp files."
  (setq dir (expand-file-name dir))
  (with-parsed-tramp-file-name dir nil
    (when (and (null parents) (file-exists-p dir))
      (tramp-error v 'file-already-exists dir))
    ;; When PARENTS is non-nil, DIR could be a chain of non-existent
    ;; directories a/b/c/...  Instead of checking, we simply flush the
    ;; whole cache.
    (tramp-flush-directory-properties
     v (if parents "/" (file-name-directory localname)))
    (tramp-barf-unless-okay
     v (format "%s -m %#o %s"
	       (if parents "mkdir -p" "mkdir")
	       (default-file-modes)
	       (tramp-shell-quote-argument localname))
     "Couldn't make directory %s" dir)))