Php file lookup program. after a path is entered, all the files and folders under the directory will be traversed, and each file under the folder can be found recursively, and then matched with the entered keyword through the file name, you can find the files you want. For more information about the files you want, see local files. we can use the windows Search, this program is useful for finding files in the ftp space.
Php file finder source code:
File search for php) <? Php/** Note: Case sensitive ** by: http://www.daixiaorui.com */if (! Empty ($ _ POST ['path']) &! Empty ($ _ POST ['key']) {echo "in path ". $ _ POST ['path']. "/in Search ". $ _ POST ['key']. the result is:
"; $ File_num = $ dir_num = 0; $ r_file_num = $ r_dir_num = 0; $ findFile = $ _ POST ['key']; function delDirAndFile ($ dirName) {if ($ handle = @ opendir ("$ dirName") {while (false! ==( $ Item = readdir ($ handle) {if ($ item! = "." & $ Item! = ".. ") {If (is_dir (" $ dirName/$ item ") {delDirAndFile (" $ dirName/$ item ");} else {$ GLOBALS ['File _ num'] ++; if (strstr ($ item, $ GLOBALS ['findfile']) {echo"$ DirName/$ item
\ N "; $ GLOBALS ['r _ file_num '] ++ ;}}} closedir ($ handle); $ GLOBALS ['dir _ num'] ++; if (strstr ($ dirName, $ GLOBALS ['findfile']) {$ loop = explode ($ GLOBALS ['findfile'], $ dirName ); $ countArr = count ($ loop)-1; if (empty ($ loop [$ countArr]) {echo"$ DirName
\ N "; $ GLOBALS ['r _ dir_num '] ++ ;}}} else {die (" This path is not available! ") ;}} DelDirAndFile ($ _ POST ['path']); echo"
". $ File_num." files, folders ". $ dir_num." are found in this query.
"; Echo"
A total of ". $ r_file_num." files and folders ". $ r_dir_num." matching results
";}?>
The above is the php file finder program. you can search for local files for easy operations and hope it will be helpful for your learning.