Macro
lispworks
with-file-stats (&rest stats) pathname if-form if-not-form => form-result
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 result of executing whichever of if-form and if-not-form is executed.
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.
(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)))
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))))