i am trying to traverse a given directory and create a list of files ending in .jpg.
(setq files (list ))
(defun jpg-list(directory)
(dolist (node (directory-files directory t ) )
(if (file-directory-p node)
(if (not
(string= (substring node (- (string-width node) 1)) "."))
(jpg-list node))
(if (string-match ".jpg" node)
(setq files (cons node files)))))
files)
i would like to do this without using an external variable (files). What is the idiomatic way of doing this in elisp?