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 (
.fountain) within a folder tree.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
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