PHP Code: 
function read_dir($dir) {
    
$handle opendir ($dir);
    while (
false !== ($f readdir ($handle))){
        if (
$f != "."){
            if (
$f != ".."){
                
$file=$dir.$f;
                if(
is_file($file)) {
                    
$ext strtolower(substr($filestrrpos($file'.') + 1));
                    if(
$ext == 'avi') echo $file.'<br />';
                
                }
            }
        }
    }
}

read_dir('full_path_to_dir');