You can search all files from a directory using the function scandir, and then comparing the name using the function pathinfo, using the parameter PATHINFO_FILENAME. Feel free to change this script to your needs.
<?php
$dir = '/tmp';
$dirFiles = scandir($dir);
$search = 'lua';
foreach($dirFiles as $file) {
if (is_file($dir.'/'.$file) AND pathinfo($dir.'/'.$file, PATHINFO_FILENAME) == $search) {
// aqui você pode fazer o que quiser
echo "Arquivo encontrado: ".$dir.'/'.$file;
}
}
?>
Follow the php documentation links to the functions used:
http://php.net/manual/en/function.scandir.php
http://php.net/manual/en/function.pathinfo.php
what do you mean catch?
– durtto
@durtto Import from my own server
– Silvio Andorinha