Skip to content

Instantly share code, notes, and snippets.

@TCotton
Created April 16, 2012 12:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TCotton/2398519 to your computer and use it in GitHub Desktop.
Save TCotton/2398519 to your computer and use it in GitHub Desktop.
Rescursivly find file
<?php
function find_files($path, $file) {
$path = rtrim(str_replace("\\", "/", $path), '/').'/*';
foreach (glob($path) as $fullname) {
if (is_dir($fullname)) {
find_files($fullname, $file);
} else {
if (preg_match($file, $fullname)) {
//print preg_replace("/\/$/", "", $fullname);
include_once (preg_replace("/\/$/", "", $fullname));
} // end if preg_match
} // end is_dir
} // end foreach
}
find_files(getenv("DOCUMENT_ROOT"), '/EpiCurl.php/');
find_files(getenv("DOCUMENT_ROOT"), '/EpiOAuth.php/');
find_files(getenv("DOCUMENT_ROOT"), '/EpiTwitter.php/');
find_files(getenv("DOCUMENT_ROOT"), '/register.php/');
find_files(getenv("DOCUMENT_ROOT"), '/tweetpost.php/');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment