I am looking for a way to open all Org (or Fountain) files in a folder using one function.
Essentially, I am seeking to open all available files of a certain type (.org
or .fountain
) within a folder tree.
I am looking for a way to open all Org (or Fountain) files in a folder using one function.
Essentially, I am seeking to open all available files of a certain type (.org
or .fountain
) within a folder tree.
Here is a solution for org files. I wouldn't recognise a Fountain file if I saw one, so you'd have to provide that one yourself. The second argument to directory-files-recursively
is a regular expression.
(defun open-org-files-recursively (dirname)
"Search DIRNAME recursively for org files, and open them all."
(interactive "D")
(mapc #'find-file (directory-files-recursively dirname "\\.org$" nil)))
Edit: The last argument to directory-files-recursively
should be nil
, in order to exclude directories whose name ends with .org
.