xref: /PHP-5.6/ext/spl/examples/findregex.php (revision e0196d11)
1<?php
2
3/** @file   findregex.php
4 * @brief   Program Find a specific file by name.
5 * @ingroup Examples
6 * @author  Marcus Boerger, Adam Trachtenberg
7 * @date    2004
8 *
9 * Usage: php findregex.php \<path\> \<name\>
10 *
11 * \<path\>  Path to search in.
12 * \<name\>  Filename to look for.
13 */
14
15if ($argc < 3) {
16	echo <<<EOF
17Usage: php findregex.php <file> <name>
18
19Find a specific file by name.
20
21<path>  Path to search in.
22<name>  Regex for filenames to look for.
23
24
25EOF;
26	exit(1);
27}
28
29if (!class_exists("RegexFindFile", false)) require_once("regexfindfile.inc");
30
31foreach(new RegexFindFile($argv[1], $argv[2]) as $file)
32{
33	echo $file->getPathname()."\n";
34}
35
36?>