Find files recursively in Emacs Lisp

To find files recursively in Emacs Lisp, use the directory-files-recursively. 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.


Return all files under directory whose names match regexp. This function searches the specified directory and its sub-directories, recursively, for files whose basenames (i.e., without the leading directories) match the specified regexp, and returns a list of the absolute file names of the matching files […].