/ Published in: PHP
This function searches the current working directory (or any other directory path that you specify with parameter $p) for a file, named $f, and returns the full path and filename of the first occurrence, or false if it is either not found or the maximum number of comparisons is reached. The return value is relative to the executing script, so you can safely pass this function to other file-handling functions, e.g. fopen(FFIND("my.file")); or file(FFIND("my.file"));
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function FFIND($f,$p=null,$l=1000) { // Recursively find a file $f in directory $p (compare up to $l files) // Returns the full path of the first occurrence (relative to current directory) // (c) Peter Mugane Kionga-Kamau http://www.visionhive.com // Free for unrestricted use with this notice and description unaltered. { { // traverse directories and compare files: } } return false; }
URL: http://www.visionhive.com