Skip to content

Instantly share code, notes, and snippets.

@seancorfield
Created October 21, 2011 19:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
(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