Glob pattern syntax
A glob pattern is a representation of a file name and optionally its path, and is a compact way of specifying multiple files with a single pattern. You can use a glob pattern to find all files in paths that match that pattern.
This syntax is used for glob patterns supported in pipelines for artifact uploads (using either artifact_paths
in a pipeline or buildkite-agent artifact upload
), and if_changed
conditions on command, trigger or group pipeline steps.
Glob patterns must match whole path strings, and cannot be used to represent substrings. However, glob patterns are evaluated relative to the current directory.
Syntax elements
Characters match themselves only, with the following syntax elements having special meaning.
Syntax element | Meaning |
---|---|
|
Used to escape the next character in the pattern, preventing it from being treated as special syntax. An escaped character matches itself exactly. For example, |
|
The path separator. Separates segments of each path. Note that on Windows, |
|
Matches exactly one arbitrary character, except for the path separator |
|
Matches zero or more arbitrary characters, except for the path separator |
|
Matches zero or more arbitrary characters, including the path separator |
|
|
|
|
|
|
|
Prior to matching, |
On Windows
The path separator on Windows is \
, and therefore, /
is the escape character when the agent performing the action is running on Windows. On other operating system platforms, /
is the standard path separator and \
is the standard escape character for the agent.
Character classes
Character classes ([abc]
) and negated character classes ([^abc]
) currently do not support ranges, and -
is treated literally. For example, [c-g]
only matches one of c
, g
, or -
.
Examples
Pattern | Explanation |
---|---|
|
Matches files in the current directory whose names start with |
|
Matches files in the current directory whose names start with |
|
Matches the file in the current directory named |
|
Matches files in the current directory whose names start with |
|
Like |
|
Like |
|
Matches all files within the |
|
Matches all files within the |
|
Matches all Go files within the current directory only. |
|
Matches all Go files within the current directory as well as any of its subdirectories. |
|
Equivalent to |
|
Matches all Go files within the |
|
Equivalent to |
|
Matches all files in every subdirectory named |
|
Matches the files |
|
Matches the files |
|
Matches the files |
|
Matches |
|
Matches all Go files within the |
|
Matches all Go files within the |
|
Matches the files |
|
Matches the files |
|
Matches the |