xref: /PHP-5.4/ext/spl/examples/findfile.php (revision 2e8b9c00)
1<?php
2
3/** @file   findfile.php
4 * @brief   Program Find a specific file by name.
5 * @ingroup Examples
6 * @author  Marcus Boerger
7 * @date    2003 - 2005
8 *
9 * Usage: php findfile.php \<path\> \<name\>
10 *
11 * \<path\>  Path to search in. You can specify multiple paths by separating
12 *         them with ';'.
13 * \<name\>  Filename to look for.
14 */
15
16if ($argc < 3) {
17	echo <<<EOF
18Usage: php findfile.php <path> <name>
19
20Find a specific file by name.
21
22<path>  Path to search in.
23<name>  Filename to look for.
24
25
26EOF;
27	exit(1);
28}
29
30if (!class_exists("FindFile", false)) require_once("findfile.inc");
31
32foreach(new FindFile($argv[1], $argv[2]) as $file) echo $file->getPathname()."\n";
33?>