Module Micmatch.Glob


module Glob: sig .. end


A generic file path matching utility
val scan : ?absolute:bool ->
?path:bool ->
?root:string ->
?nofollow:bool -> (string -> unit) -> (string -> bool) list -> unit
scan action path_filter returns all the file paths having a name that matches path_filter. path_filter is a list of filters that test whether a directory name or a file name should be selected.

The path search starts from the current directory by default, or from the directory specified by the root option. The file names are examined in an undefined order. When a file path matches, action is applied to the string representing the path. Options absolute and path have the same meaning and the same default values as in Micmatch.Directory.list.

nofollow can be used to prevent from considering symbolic links as directories. It is false by default. See also Micmatch.Directory.is_dir.

val lscan : ?rev:bool ->
?absolute:bool ->
?path:bool ->
?root:string list ->
?nofollow:bool -> (string list -> unit) -> (string -> bool) list -> unit
Same as Micmatch.Glob.scan but file paths are kept as a list of strings that form a valid path when concatenated using Filename.concat. Option rev can be set if the lists representing paths are in reversed order, i.e. the root comes last.

In lscan action path_filter, options rev, absolute, and path take their default values which are all false. In this situation, it is guaranteed that the paths that are passed to action have the same length as path_filter.

val list : ?absolute:bool ->
?path:bool ->
?root:string ->
?nofollow:bool -> ?sort:bool -> (string -> bool) list -> string list
list path_filter works like Micmatch.Glob.scan but returns a list of all file paths that match path_filter.

An example in Micmatch syntax is list [FILTER _* ".ml" eos]. It returns the list of ".ml" files in the current directory. It could have been written as list [ fun s -> Filename.check_suffix s ".ml"] and is equivalent to *.ml in shell syntax.

val llist : ?rev:bool ->
?absolute:bool ->
?path:bool ->
?root:string list ->
?nofollow:bool -> ?sort:bool -> (string -> bool) list -> string list list
llist path_filter works like Micmatch.Glob.lscan but returns a list of all file paths that match path_filter.