Any of: author, length, write-date.
A pathname.
A form that gets executed if the pathname can be accessed.
A form that gets executed if the pathname cannot be accessed.
The with-file-stats
macro is a more efficient way of interrogating a file for author, length, and write-date if more than one needs to be known.
Without this function, a simple file interrogation function might look like this:
(defun print-file-info (pathname)
(if (file-readable-p pathname)
(format t "~%Author: ~A~%Size: ~A~%Write-Date: ~A~%"
(file-author pathname)
(file-length pathname)
(file-write-date pathname))
(format t "Cannot read ~A" pathname)))
The function can be written more efficiently using with-file-stats
:
(defun print-file-info (pathname)
(with-file-stats (author length write-date) pathname
(format t "~%Author: ~A~%Size: ~A~%Write-Date: ~A~%"
author
length
write-date
(format t "Cannot read ~A" pathname))))