Eglob.jl

The Eglob Module

§ EglobModule.

import Eglob: eglob, eglobt

Eglob provides extended globbing functions that support a recursive ** wildcard pattern, similar to the ** supported by the Bash (version 4+) globstar option and by Zsh. This package is built on top of Glob.lj.

See the docs for the individual functions for more information.

source

§ Eglob.eglobFunction.

eglob(pattern)

An extended globbing function that supports all the wildcards of the glob() function, plus:

eglob() is just a convenience front-end. It is exactly equivalent to:

[match for match in eglobt(pattern)]

Parameters:

Returns an array of expanded path names, which might be empty. If the original path contains no wildcards, the result will be a 1-element array containing the original path.

Note: This function expands the entire pattern before returning. If you’re expanding a pattern in a deeply-nested directory tree, eglob() can take awhile to return. If you want to process the results in a way that allows you to stop before seeing all of them, use eglobt().

source

§ Eglob.eglobtFunction.

eglobt(pattern)

An extended, Task- and Channel-based globbing function that supports all the wildcards of the glob() function, plus:

Parameters:

Returns the channel to which results will be written.

Examples

Example 1:

julia> import Glob: eglobt
julia> c = eglobt("**/*.csv") # find all CSV files below the current directory
julia> match1 = take!(c)
julia> match2 = take!(c)

Example 2:

# We only want three of them, but there might not be that many, so handle
# a prematurely empty channel.
import Glob: eglobt
c = eglobt("src/**/*.scala")
matches = []
for (i, match) in enumerate(c)
    if i > 3
        break
    end
    append!(matches, [match])
end

Example 3:

# Consume all matches. This is exactly what eglob() does.
matches = [match for match in eglobt("test/**/*.py")]

source