glob

Return all the paths that match the glob pattern

string[]
glob
(
string path_name
)

Parameters

path_name
Type: string

The path with paterns to match.

Examples

1 import glob : glob;
2 
3 // Use * to match zero or more instances of a character
4 string[] entries = glob("/usr/bin/python*");
5 /*
6 entries would contain:
7 /usr/bin/python2
8 /usr/bin/python2.7
9 /usr/bin/python3
10 /usr/bin/python3.5
11 */
12 
13 // Use ? to match one instance of a character
14 entries = glob("/usr/bin/python2.?");
15 /*
16 entries would contain:
17 /usr/bin/python2.6
18 /usr/bin/python2.7
19 */
20 
21 // Use [] to match one instance of a character between the brackets
22 entries = glob("/usr/bin/python[23]");
23 /*
24 entries would contain:
25 /usr/bin/python2
26 /usr/bin/python3
27 */
28 
29 // Use [!] to match one instance of a character NOT between the brackets
30 entries = glob("/usr/bin/python[!3]");
31 /*
32 entries would contain:
33 /usr/bin/python2
34 */
35 
36 // Use {} to match any of the full strings
37 entries = glob("/usr/bin/{python,ruby}");
38 /*
39 entries would contain:
40 /usr/bin/python
41 /usr/bin/ruby
42 */

Meta