Created
March 3, 2013 03:12
-
-
Save danlamanna/5074315 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun recursive-find-dirs(dir-name dir &optional working-dirs) | |
"find all directories with the name DIR-NAME within DIR, recursively." | |
(print working-dirs) | |
(setq working-dirs (or working-dirs '())) | |
(let ((dirs (directory-files-and-attributes dir t directory-files-no-dot-files-regexp))) | |
(when dirs | |
(dolist (current-dir dirs) | |
(when (file-directory-p (car current-dir)) | |
(if (string-equal (car (last (split-string (car current-dir) "/"))) dir-name) | |
(push (car current-dir) working-dirs)) | |
(recursive-find-dirs dir-name (car current-dir) working-dirs))))) | |
working-dirs) | |
;; print shows that it always (at some point) has all of the directories found correctly, | |
;; however one or more somehow get removed. also it always RETURNS nil. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment