findregex.php 657 B

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