Skip to content

Instantly share code, notes, and snippets.

@bhenry
Created August 17, 2010 18:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bhenry/531279 to your computer and use it in GitHub Desktop.
Save bhenry/531279 to your computer and use it in GitHub Desktop.
(defn get-files [dir]
(let [data (filter #(.isFile ^File %)
(file-seq (java.io.File. dir)))]
(sort-by #(.lastModified %) < data)))
(defn image? [f]
"takes a file object and returns true if it has an
approved image extension."
(if (re-find #"(?i)[.](gif|jpg|png)$" (.getName f))
true
false))
(defn get-imgs [dir]
(filter image? (get-files dir)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment