I have multiple org files in my Dropbox directory. I wanted to add all of them into my org-agenda. So as normally prescribed I used org-agenda-files. Infact I'm adding the the part of my .emacs that corresponds to org-mode setup below

;; ############  ORG-MODE  ####################
;; ## To enable shift - arrow mode for navigation (does not work in CUA mode)
(require 'org)
(setq org-support-shift-select t)
(setq org-todo-keywords
      '((sequence "TODO(t)" "STARTED(s)" "ISSUE(p)" "INPUTNEEDED(i)" "VERIFY(v)" "|" "SCOPECHANGE(c)" "DONE(d)" "DELEGATED(o)")))
;; To hightlight code blocks ** SO Link: https://stackoverflow.com/questions/10642888/syntax-highlighting-within-begin-src-block-in-emacs-orgmode-not-working **
(setq org-src-fontify-natively t)
(setq org-directory "~/orgFiles")
(setq org-mobile-inbox-for-pull  "~/orgFiles/from-mobile.org")
(setq org-mobile-directory "~/Apps/mobileorg")
;; ## Make RefTeX work in org-mode
;; ## https://emacs.stackexchange.com/questions/3375/loading-bibtex-file-in-org-mode-file
(setq org-latex-pdf-process '("texi2dvi -p -b -V %f"))
(define-key org-mode-map (kbd "C-c [") 'org-reftex-citation)

(setq org-agenda-files '("~/Professional"))

I also verified that the variable is getting set by Performing M-x customize-variable org-agenda-files. Now when I perform M-x org-agenda t. I get the following output

Global list of TODO items of type: ALL
Available with `N r': (0)[ALL]

I have numerous TODO in the org-files in the folder and I dont know why they dont get reported in the org-agenda

  • I wonder if you need to escape the space in the pathnames. So just do (setq org-directory "/Users/kw1/Dropbox\ (Personal)/orgFiles"), etc.
    – MTS
    Commented Sep 2, 2016 at 18:11
  • The problem is I want the org files to be found recursively and I think org-agenda-files cannot do that. Do you know of a way to find the org files recursively? Commented Sep 2, 2016 at 18:41

1 Answer 1


I fixed the problem. Apparently the org-agenda-files can only add the org files that are immediately in the directory path. It cannot recursively add org files in the subdirectories, which was how my org files were stored. I solved it using the recipe as described in the SO answer here. The full elisp code is attached below

;; ## Search org files recursively and add it to agenda
;; https://stackoverflow.com/questions/11384516/how-to-make-all-org-files-under-a-folder-added-in-agenda-list-automatically
;; recursively find .org files in provided directory
;; modified from an Emacs Lisp Intro example
(defun sa-find-org-file-recursively (&optional directory filext)
  "Return .org and .org_archive files recursively from DIRECTORY.
If FILEXT is provided, return files with extension FILEXT instead."
  (interactive "DDirectory: ")
  (let* (org-file-list
     (case-fold-search t)         ; filesystems are case sensitive
     (file-name-regex "^[^.#].*") ; exclude dot, autosave, and backup files
     (filext (or filext "org$\\\|org_archive"))
     (fileregex (format "%s\\.\\(%s$\\)" file-name-regex filext))
     (cur-dir-list (directory-files directory t file-name-regex)))
    ;; loop over directory listing
    (dolist (file-or-dir cur-dir-list org-file-list) ; returns org-file-list
       ((file-regular-p file-or-dir) ; regular files
    (if (string-match fileregex file-or-dir) ; org files
        (add-to-list 'org-file-list file-or-dir)))
       ((file-directory-p file-or-dir)
    (dolist (org-file (sa-find-org-file-recursively file-or-dir filext)
              org-file-list) ; add files found to result
      (add-to-list 'org-file-list org-file)))))))

(setq org-agenda-files
      (append (sa-find-org-file-recursively "~/Professional")))

(setq org-agenda-text-search-extra-files
      (append (sa-find-org-file-recursively "~/Professional" "txt")
              (sa-find-org-file-recursively "~/Professional" "tex")))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.