Find all files in the given $path recursively, and return a flat array of all found filenames

Usage

// basic usage
$array = $files->find(string $path);

// usage with all arguments
$array = $files->find(string $path, array $options = []);

Arguments

NameType(s)Description
$pathstring

Path to start from (required).

$options (optional)array

Options to affect what is returned (optional):

  • recursive (int): How many levels of subdirectories this method should descend into (default=10).
  • extensions (array): Only include files having these extensions, or omit to include all (default=[]).
  • excludeDirNames (array): Do not descend into directories having these names (default=[]).
  • excludeHidden (bool): Exclude hidden files? (default=false).
  • returnRelative (bool): Make returned array have filenames relative to given start $path? (default=false)

Return value

array

Flat array of filenames


$files methods and properties

API reference based on ProcessWire core version 3.0.66