Page MenuHomePhorge

final class FileFinder
libphutil Technical Documentation (Filesystem)

Find files on disk matching criteria, like the 'find' system utility. Use of this class is straightforward:

// Find PHP files in /tmp
$files = id(new FileFinder('/tmp'))
  ->withType('f')
  ->withSuffix('php')
  ->find();

Tasks

Creating a File Query

  • public function __construct($root) — Create a new FileFinder.

Configuring File Queries

Executing the File Query

  • public function find()

Internal

Other Methods

Methods

public function __get($name)
Inherited

This method is not documented.
Parameters
$name
Return
wild

public function __set($name, $value)
Inherited

This method is not documented.
Parameters
$name
$value
Return
wild

public function current()
Inherited

This method is not documented.
Return
wild

public function key()
Inherited

This method is not documented.
Return
wild

public function next()
Inherited

This method is not documented.
Return
wild

public function rewind()
Inherited

This method is not documented.
Return
wild

public function valid()
Inherited

This method is not documented.
Return
wild

private function throwOnAttemptedIteration()
Inherited

This method is not documented.
Return
wild

public function getPhobjectClassConstant($key, $byte_limit)
Inherited

Phobject

Read the value of a class constant.

This is the same as just typing self::CONSTANTNAME, but throws a more useful message if the constant is not defined and allows the constant to be limited to a maximum length.

Parameters
string$keyName of the constant.
int|null$byte_limitMaximum number of bytes permitted in the value.
Return
stringValue of the constant.

public function __construct($root)

Create a new FileFinder.

Parameters
string$rootRoot directory to find files beneath.
Return
this//Implicit.//

public function excludePath($path)

This method is not documented.
Parameters
$path
Return
wild

public function withName($name)

This method is not documented.
Parameters
$name
Return
wild

public function withSuffix($suffix)

This method is not documented.
Parameters
$suffix
Return
wild

public function withPath($path)

This method is not documented.
Parameters
$path
Return
wild

public function withType($type)

This method is not documented.
Parameters
$type
Return
wild

public function withFollowSymlinks($follow)

This method is not documented.
Parameters
$follow
Return
wild

public function setGenerateChecksums($generate)

This method is not documented.
Parameters
$generate
Return
wild

public function getGenerateChecksums()

This method is not documented.
Return
wild

public function withNameGlob($pattern)

This method is not documented.
Parameters
$pattern
Return
wild

public function setForceMode($mode)

This method is not documented.
Parameters
string$modeEither "php", "shell", or the empty string.
Return
wild

public function validateFile($file)

This method is not documented.
Parameters
$file
Return
wild

private function getFiles($dir)

This method is not documented.
Parameters
$dir
Return
wild

public function find()

This method is not documented.
Return
wild

private function generateList($flag, $items, $mode)

This method is not documented.
Parameters
$flag
array$items
$mode
Return
wild