Finder
class Finder implements IteratorAggregate
Searches for files and directories in directory trees.
Finder::findFiles('*.php') ->size('> 10kB') ->from('.') ->exclude('temp');
Methods
Begins search for files and directories matching mask.
Begins search for directories matching mask.
Finds directories matching the specified masks.
Searches recursively from the given directories. Wildcards are allowed.
Lists directory's contents before the directory itself. By default, this is disabled.
Ignores unreadable directories. By default, this is enabled.
Sets a comparison function for sorting entries within each directory.
Sorts files in each directory naturally by name.
Appends the specified file paths to results. Passing null creates and returns a new sub-finder whose results are appended.
Skips entries that matches the given masks relative to the ones defined with the in() or from() methods.
It descends only to directories that match the specified filter.
Sets the maximum depth of entries.
Restricts the search by size. $operator accepts "[operator] [size] [unit]" example: >=10kB
Restricts the search by modified time. $operator accepts "[operator] [date]" example: >1978-01-23
Returns an array with all found files and directories.
No description
Details
at line 53
static Finder
find(string|array $masks = ['*'])
Begins search for files and directories matching mask.
at line 64
static Finder
findFiles(string|array $masks = ['*'])
Begins search for files matching mask.
at line 75
static Finder
findDirectories(string|array $masks = ['*'])
Begins search for directories matching mask.
at line 86
Finder
files(string|array $masks = ['*'])
Finds files matching the specified masks.
at line 96
Finder
directories(string|array $masks = ['*'])
Finds directories matching the specified masks.
at line 126
Finder
in(string|array $paths)
Searches in the given directories. Wildcards are allowed.
at line 138
Finder
from(string|array $paths)
Searches recursively from the given directories. Wildcards are allowed.
at line 162
Finder
childFirst(bool $state = true)
Lists directory's contents before the directory itself. By default, this is disabled.
at line 172
Finder
ignoreUnreadableDirs(bool $state = true)
Ignores unreadable directories. By default, this is enabled.
at line 183
Finder
sortBy(callable $callback)
Sets a comparison function for sorting entries within each directory.
at line 193
Finder
sortByName()
Sorts files in each directory naturally by name.
at line 204
Finder
append(string|array|null $paths = null)
Appends the specified file paths to results. Passing null creates and returns a new sub-finder whose results are appended.
at line 222
Finder
exclude(string|array $masks)
Skips entries that matches the given masks relative to the ones defined with the in() or from() methods.
at line 249
Finder
filter(callable $callback)
Yields only entries which satisfy the given filter.
at line 260
Finder
descentFilter(callable $callback)
It descends only to directories that match the specified filter.
at line 270
Finder
limitDepth(int|null $depth)
Sets the maximum depth of entries.
at line 281
Finder
size(string $operator, int|null $size = null)
Restricts the search by size. $operator accepts "[operator] [size] [unit]" example: >=10kB
at line 302
Finder
date(string $operator, string|int|DateTimeInterface|null $date = null)
Restricts the search by modified time. $operator accepts "[operator] [date]" example: >1978-01-23
at line 325
array
collect()
Returns an array with all found files and directories.
at line 332
Generator
getIterator()
No description