php - finding files in a dir -
i have directory lot of files inside:
pic_1_79879879879879879.jpg pic_1_89798798789798789.jpg pic_1_45646545646545646.jpg pic_2_12345678213145646.jpg pic_3_78974565646465645.jpg etc...
i need list pic_1_ files. idea how can do? in advance.
the opend dir function you
$dir ="your path here"; $filetoread ="pic_1_"; if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (strpos($file,$filetoread) !== false) echo "filename: $file : filetype: " . filetype($dir . $file) . "\n"; } closedir($dh); } }
good luck see php.net opendir
Comments
Post a Comment