Search files in directory with php
Free Scripts :: PHP :: Files and Folders :: Search files in directory with php
Author: Salman Javaid
Website: http://www.salman.be
Website: http://www.salman.be
- How to search files of a directory with php.
- search a file from a folder with php.
This script searches the files located in folder by matching keyword.
Script
$string_to_search='btn';
$path='pictures/products/';
$handle=opendir($path);
while (($file = readdir($handle))!==false){
if ($file!="." && $file!=".."){
if(strstr($file,$string_to_search)!==false){
echo $file . ', ';
}
}
}
Output
btnDelete.gif, Previewbtn.gif




