Created
August 17, 2010 18:25
-
-
Save bhenry/531279 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
(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