luaposix 36.3 Reference

# 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` and `GLOB_NOCHECK`

  ### Returns:

  table matching filenames, if successful

  ### Or

  1. nil
  2. one of `GLOB_ABORTED`, `GLOB_NOMATCH` or `GLOB_NOSPACE`

  ### See also:

  - glob(3)
  - glob.lua

## 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

generated by LDoc 1.5.0 Last updated 2025-02-16 13:16:41