# lfs

Extends the `lfs` library to find files in directories.

- - -

## Functions

- - -

<a id="dir_foreach"></a>
### `dir_foreach`(*utf8\_dir, f, filter, exclude\_FILTER, recursing*)

Iterates over all files and sub-directories in the UTF-8-encoded directory
*utf8_dir*, calling function *f* on each file found.
Files *f* is called on do not match any pattern in string or table *filter*,
and, unless *exclude_FILTER* is `true`, `FILTER` as well. A filter table
contains Lua patterns that match filenames to exclude, with patterns matching
folders to exclude listed in a `folders` sub-table. Patterns starting with
'!' exclude files and folders that do not match the pattern that follows. Use
a table of raw file extensions assigned to an `extensions` key for fast
filtering by extension. All strings must be encoded in `_G._CHARSET`, not
UTF-8.

Parameters:

* *`utf8_dir`*: A UTF-8-encoded directory path to iterate over.
* *`f`*: Function to call with each full file path found. File paths are
  **not** encoded in UTF-8, but in `_G._CHARSET`. If *f* returns `false`
  explicitly, iteration ceases.
* *`filter`*: Optional filter for files and folders to exclude.
* *`exclude_FILTER`*: Optional flag indicating whether or not to exclude the
  default filter `FILTER` in the search. If `false`, adds `FILTER` to
  *filter*.
  The default value is `false` to include the default filter.
* *`recursing`*: Utility flag indicating whether or not this function has
  been recursively called. This flag is used and set internally, and should
  not be set otherwise.

See also:

* [`FILTER`](#FILTER)

- - -


## Tables

- - -

<a id="FILTER"></a>
### `FILTER`

Filter table containing common binary file extensions and version control
folders to exclude when iterating over files and directories using
`dir_foreach` when its `exclude_FILTER` argument is `false`.

See also:

* [`dir_foreach`](#dir_foreach)

- - -

