Created
June 29, 2021 06:54
-
-
Save rotaliator/9cd13bbb3d8e6bf1f86a6afd1a3cd158 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
| (require '[clojure.java.io :as io]) | |
| (defn filter-files [path mask] | |
| (let [matcher (.getPathMatcher | |
| (java.nio.file.FileSystems/getDefault) | |
| (str "glob:" mask))] | |
| (->> path | |
| io/file | |
| file-seq | |
| (filter #(.isFile %)) | |
| (filter #(.matches matcher (.getFileName (.toPath %)))) | |
| (map #(.getAbsolutePath %))))) | |
| (comment | |
| (filter-files "." "*.clj") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment