Lisp HUG Maillist Archive

Useful functions

Dear List,

The following form computes the number of files and directories
installed by all the Debian packages of a Debian GNU/Linux system.

(let ((files
       (directory
        (make-pathname
         :directory '(:absolute "var" "lib" "dpkg" "info")
         :name :wild
         :type "list")))
      (temp-file (concatenate 'string "/tmp/" (string (gensym "pipe")))))
  (with-open-file (s temp-file :direction :output :if-exists :supersede)
    (dolist (f files)
      (dolist (line (sm:x "cat" (list (namestring f))))
        (format s "~A~%" line))))
  (pipe (concatenate 'string "cat " temp-file "|sort|uniq|wc -l"))
  (delete-file temp-file))

The functions x and pipe are in sian.lisp in the src directory on my
web-site (see my sig).

-- 
Dr Sian Mountbatten
http://www.poenikatu.co.uk/
Associate member of the FSF no. 10888
Asocia membro de la Libera Programara Fonduso n-ro 10888

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html


Updated at: 2020-12-10 08:34 UTC