Find files recursively in Emacs Lisp

To find files recursively in Emacs Lisp, use the directory-files-recursively.1 The first argument is the directory the recursive search starts and the second is a regular expression that matches file basenames.

(directory-files-recursively "." "\\.org$")
("./sub/" "./")

The optional third and fourth arguments allow for including directories and following symlinks.

  1.​_node/elisp/Contents-of-Directories.html ↩︎