Created
October 21, 2011 19:47
-
-
Save seancorfield/1304756 to your computer and use it in GitHub Desktop.
This file contains 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
(defn- wildcard-filter | |
"Given a regex, return a FilenameFilter that matches." | |
[re] | |
(reify java.io.FilenameFilter | |
(accept [_ dir name] (not (nil? (re-find re name)))))) | |
(defn- directory-list | |
"Given a directory and a regex, return a sorted seq of matching filenames." | |
[dir re] | |
(sort (.list (clojure.java.io/file dir) (wildcard-filter re)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment