masinter@masunter.PARC.xerox.com (Larry Masinter) (08/25/89)
I need to get a file's owner & its creation date as strings.
file-attributes returns the values coded, but there doesn't seem any
simple way to turn those values into strings, at least in the
'correct' format. I need the file creation date in some canonical
format that includes the time & date (e.g., the format that
(current-time-string) uses would do.)
;; This is what I'm doing, which is awful on a number of counts:
(defun 33file-attributes (file)
"Return list of file creator, last modification."
(save-excursion
(let((buf (get-buffer-create "*33 ls*")))
(set-buffer buf)
(erase-buffer)
(call-process "ls" nil t nil "-l -d" file)
(goto-char 15) (forward-word 1)
(list (buffer-substring 15 (point))
(buffer-substring 33 45)))))
;; Something like this would be OK
(defun 33file-attributes (file)
(let ((att (file-attributes file)))
(list (uid-name (nth 2 att)) ;no way to do this
(date-string (nth 4 att))))) ;probably I could hack this in ELisp
Suggestions?
--
Larry Masinter (Masinter.PA@Xerox.COM)
Xerox Palo Alto Research Center (PARC)
3333 Coyote Hill Road; Palo Alto, CA USA 94304
TEL: (415)494-4365