PHP Code: 
<?php

$folder 
= array(); // Creates a array for use later

foreach (glob("/location/folder1/*.avi") as $thefolder) { // Use for each to go through and get each folder & file in the given directory
    
If (is_file($thefolder)) { // We only want to get files so we are making sure that we are adding a file and not a directory.
        
$folder[] = $thefolder// Adds the file to the array created
    
}
}

print_r($folder); // Print out the list for debug

?>
You can specify the filename search pattern in glob