Created
June 10, 2020 04:05
-
-
Save pmonks/0cabacfe71f06c295cf87f417e299f25 to your computer and use it in GitHub Desktop.
A tree seq on java.io.Files that doesn't follow symlinks (requires Java 1.7+)
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 file-seq | |
"A tree seq on java.io.Files that doesn't follow symlinks" | |
[dir] | |
(tree-seq | |
(fn [^java.io.File f] (and (.isDirectory f) (not (java.nio.file.Files/isSymbolicLink (.toPath f))))) | |
(fn [^java.io.File d] (seq (.listFiles d))) | |
dir)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment