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/two.org" "./one.org")

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

References

https://www.gnu.org/software/emacs/manual/html​_node/elisp/Contents-of-Directories.html

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 […].