PathGlob
tests whether a file path matches a glob pattern, without touching
the filesystem. It has the same semantics as Path.wildcard/2
.
Path.wildcard/2
allows you to find all paths that match a certain glob
pattern. If you only want to know whether a particular path matches a glob,
then Path.wildcard/2
can be slow (depending on the glob), because it needs to
traverse the filesystem.
PathGlob
provides a PathGlob.match?/3
function to check a path against a
glob without touching the filesystem. Internally, the glob pattern is compiled
to a Regex
and then checked via String.match?/2
. If you want to compile the
glob pattern ahead-of-time, you can use PathGlob.compile/2
.
More: