This module provides file searching predicates to locate pathnames matching a globbing pattern (shell wildcard expansion).
Usage:glob_pattern(Pattern)
Pattern is a pathname pattern whose components may contain shell-style wildcards.
Search the list of pathnames FileList matching the specified pathname pattern Pattern. If Pattern is an absolute path, Directory is ignored. Otherwise, all matches are relative to Directory. If Directory does not exist FileList is empty. The shortest version glob/2 can be used when Directory is '.' (the current directory).
For example, glob/2 and glob/3 will give the following results in a typical Unix installation:
?- use_module(library(glob)). yes ?- cd('/bin'). yes ?- glob('e*', F). F = [expr,ed,echo] ? yes ?- glob('/', 'bin/e*', F). F = ['bin/expr','bin/ed','bin/echo'] ? yes ?- glob('/tmp', '../bin/e*', F). F = ['../bin/expr','../bin/ed','../bin/echo'] ? yes ?- cd('/tmp'). yes ?- glob('/bin/e*', F). F = ['/bin/expr','/bin/ed','/bin/echo'] ? yes
Usage:glob(Directory,Pattern,FileList)
FileList is the list of pathnames matching the specified pathname pattern Pattern, relative to Directory.
Usage:glob(Pattern,FileList)
Like glob/3, relative to the current directory (equivalent to glob('.', Pattern, FileList))