Guys, I hope you can give me an idea. Im trying to create a small script that searches a file or directory. Something like $current_directory=$_SERVER['DOCUMENT_ROOT']; if(!is_dir($current_directory)){ if ($handle = opendir($current_directory)){ while (false !== ($file = readdir($handle))) { if(is_file($file)){ if ($file==trim($search_key)){ // File found } } } } Im having trouble if the directory has a directory inside. How i can keep on search the file in all directory Thanks, Mike
http://us3.php.net/glob You should look over the glob fuction. That page has a bunch of file searching routines that use the glob function of php.
Hi exodus, Thanks for the quickhelp. Im not sure, but still im having trouble with the logic, coz im planning to look for a file/folder with in a given directory. Exampl i want to look for test file/folder and the structure of my directory is this /test /folderA/test.txt /folderA/folderB/folderC/test.txt see what i mean, im stuck with the looping within subdirectory, coz i want to display on where all the search string test in all direcory either its a file or folder Thanks, Mike