Module posix.glob
Generate pathnames matching a shell-style pattern.
Functions generating a table of filenames that match a shell-style pattern string.
Functions
glob ([pat="*"], flags) | Find all files in this directory matching a shell pattern. |
Constants
posix.glob | Glob constants. |
Functions
- glob ([pat="*"], flags)
-
Find all files in this directory matching a shell pattern.
Parameters:
- pat string shell glob pattern (default "*")
- flags
bitwise inclusive OR of zero or more of
GLOB_ERR
,GLOB_MARK
andGLOB_NOCHECK
Returns:
-
table
matching filenames, if successful
Or
- nil
-
one
of
GLOB_ABORTED
,GLOB_NOMATCH
orGLOB_NOSPACE
See also:
Constants
- posix.glob
-
Glob constants.
Fields:
- GLOB_MARK int append slashes to matches that are directories.
- GLOB_ERR int instead of ignoring non-readable directories, return GLOB_ABORTED
- GLOB_ABORTED int encountered a non-readable directory
- GLOB_NOCHECK int return the original pattern if there are no matches
- GLOB_NOMATCH int pattern does not match any existing pathname
- GLOB_NOSPACE int not enough memory to continue
Usage:
-- Print glob constants supported on this host. for name, value in pairs (require "posix.glob") do if type (value) == "number" then print (name, value) end end