Finder::sort()

Finder|SplFileInfo[] sort(Closure $closure) Sorts files and directories by an anonymous function. The anonymous function receives two \SplFileInfo instances to compare. This can be slow as all the matching files and directories must be retrieved for comparison. Parameters Closure $closure An anonymous function Return Value Finder|SplFileInfo[] The current Finder instance See also SortableIterator

Finder::notPath()

Finder|SplFileInfo[] notPath(string $pattern) Adds rules that filenames must not match. You can use patterns (delimited with / sign) or simple strings. $finder->notPath('some/special/dir') $finder->notPath('/some\/special\/dir/') // same as above Use only / as dirname separator. Parameters string $pattern A pattern (a regexp or a string) Return Value Finder|SplFileInfo[] The current Finder instance See also FilenameFilterIterator

Finder::size()

Finder|SplFileInfo[] size(string $size) Adds tests for file sizes. $finder->size('> 10K'); $finder->size('<= 1Ki'); $finder->size(4); Parameters string $size A size range string Return Value Finder|SplFileInfo[] The current Finder instance See also SizeRangeFilterIterator NumberComparator

Finder::path()

Finder|SplFileInfo[] path(string $pattern) Adds rules that filenames must match. You can use patterns (delimited with / sign) or simple strings. $finder->path('some/special/dir') $finder->path('/some\/special\/dir/') // same as above Use only / as dirname separator. Parameters string $pattern A pattern (a regexp or a string) Return Value Finder|SplFileInfo[] The current Finder instance See also FilenameFilterIterator

Finder::in()

Finder|SplFileInfo[] in(string|array $dirs) Searches files and directories which match defined rules. Parameters string|array $dirs A directory path or an array of directories Return Value Finder|SplFileInfo[] The current Finder instance Exceptions InvalidArgumentException if one of the directories does not exist

Finder::notName()

Finder|SplFileInfo[] notName(string $pattern) Adds rules that files must not match. Parameters string $pattern A pattern (a regexp, a glob, or a string) Return Value Finder|SplFileInfo[] The current Finder instance See also FilenameFilterIterator

Finder::name()

Finder|SplFileInfo[] name(string $pattern) Adds rules that files must match. You can use patterns (delimited with / sign), globs or simple strings. $finder->name('*.php') $finder->name('/.php$/') // same as above $finder->name('test.php') Parameters string $pattern A pattern (a regexp, a glob, or a string) Return Value Finder|SplFileInfo[] The current Finder instance See also FilenameFilterIterator

Finder::notContains()

Finder|SplFileInfo[] notContains(string $pattern) Adds tests that file contents must not match. Strings or PCRE patterns can be used: $finder->notContains('Lorem ipsum') $finder->notContains('/Lorem ipsum/i') Parameters string $pattern A pattern (string or regexp) Return Value Finder|SplFileInfo[] The current Finder instance See also FilecontentFilterIterator

Finder::ignoreDotFiles()

Finder|SplFileInfo[] ignoreDotFiles(bool $ignoreDotFiles) Excludes "hidden" directories and files (starting with a dot). Parameters bool $ignoreDotFiles Whether to exclude "hidden" files or not Return Value Finder|SplFileInfo[] The current Finder instance See also ExcludeDirectoryFilterIterator

Finder::ignoreUnreadableDirs()

Finder|SplFileInfo[] ignoreUnreadableDirs(bool $ignore = true) Tells finder to ignore unreadable directories. By default, scanning unreadable directories content throws an AccessDeniedException. Parameters bool $ignore Return Value Finder|SplFileInfo[] The current Finder instance