Function: tramp-sh-handle-file-attributes

tramp-sh-handle-file-attributes is a byte-compiled function defined in tramp-sh.el.gz.

Signature

(tramp-sh-handle-file-attributes FILENAME &optional ID-FORMAT)

Documentation

Like file-attributes for Tramp files.

Source Code

;; Defined in /usr/src/emacs/lisp/net/tramp-sh.el.gz
(defun tramp-sh-handle-file-attributes (filename &optional id-format)
  "Like `file-attributes' for Tramp files."
  (unless id-format (setq id-format 'integer))
  (ignore-errors
    ;; Don't modify `last-coding-system-used' by accident.
    (let ((last-coding-system-used last-coding-system-used))
      (with-parsed-tramp-file-name (expand-file-name filename) nil
	(with-tramp-file-property
	    v localname (format "file-attributes-%s" id-format)
	  (tramp-convert-file-attributes
	   v
	   (or
	    (cond
	     ((tramp-get-remote-stat v)
	      (tramp-do-file-attributes-with-stat v localname id-format))
	     ((tramp-get-remote-perl v)
	      (tramp-do-file-attributes-with-perl v localname id-format))
	     (t nil))
	    ;; The scripts could fail, for example with huge file size.
	    (tramp-do-file-attributes-with-ls v localname id-format))))))))