match
function
babashka.fs/match
(match [root pattern] [root pattern {:keys [hidden follow-links max-depth recursive]}])Returns a vector of paths matching `pattern` (on path and filename) relative to `root` dir.
Pattern interpretation is done using the rules described in
[FileSystem#getPathMatcher](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/file/FileSystem.html#getPathMatcher(java.lang.String))
Options:
* `:hidden` - match hidden paths - note: on Windows paths starting with
a dot are not hidden, unless their hidden attribute is set. Defaults to
`false`, i.e. skip hidden files and folders.
* [`:follow-links`](/README.md#follow-links) - follow symlinks. Defaults to false.
* `:recursive`
* `true`, `pattern` is matched against all descendant files and directories under `root`
* `false` (default), `pattern` is matched only against immediate children under `root`
* `:max-depth` - max depth to descend into directory structure, when
matching recursively. Defaults to `Integer/MAX_VALUE`.
Examples:
- `(fs/match "." "regex:.*\\.clj" {:recursive true})`
See also: [[glob]]
Examples
No examples yet. Be the first to add one!