std.fs.walk

match-filter

added in 3.0

(match-filter {:keys [path attrs root include exclude with], :as m})

matches according to many filters

(match-filter {}) => true

(match-filter {:root (path/path "") :path (path/path “src/hara/test.clj”) :include {:tag :pattern :pattern #“test”}}) => true

(match-filter {:root (path/path "") :path (path/path “src/hara/test.clj”) :exclude {:tag :pattern :pattern #“test”}}) => false

match-single

added in 3.0

(match-single {:keys [root path attrs], :as m} {:keys [tag], :as single})

matches according to the defined filter

(match-single {:root (path/path “.”) :path (path/path “src/hara/test.clj”)} {:tag :pattern :pattern #“src”}) => true

(match-single {:root (path/path “src”) :path (path/path “src/hara/test.clj”)} {:tag :pattern :pattern #“src”}) => false

(match-single {:path (path/path “src/hara/test.clj”)} {:tag :fn :fn (fn m (re-find #“hara” (str m)))}) => true

visit-directory-post

added in 3.0

(visit-directory-post m)

helper function, triggers after visiting a directory

visit-directory-pre

added in 3.0

(visit-directory-pre {:keys [root path attrs accumulate], :as m})

helper function, triggers before visiting a directory

visit-file

added in 3.0

(visit-file {:keys [path attrs accumulate], :as m})

helper function, triggers on visiting a file

visit-file-failed

added in 3.0

(visit-file-failed m)

helper function, triggers on after a file cannot be visited

visitor

added in 3.0

(visitor m)

contructs the clojure wrapper for java.nio.file.FileVisitor

walk

added in 3.0

(walk root {:keys [directory file include exclude recursive depth options accumulator accumulate with], :as m})

visits files based on a directory

(walk “src” {:accumulate #{:directories}}) => vector?

(walk “src” {:accumulator (atom {}) :accumulate #{} :file (fn [{:keys path attrs accumulator}] (swap! accumulator assoc (str path) (.toMillis (.lastAccessTime ^BasicFileAttributes attrs))))}) => map?