Question : php get all txt files in directory
Answered by : tomatentim
$path = '/path/to/directory';
$files = glob($path."/*.txt");
foreach ($files as $file) { echo $file; echo '<br>';
}
/* Outputs something like: /path/to/directory/someFile.txt /path/to/directory/someOtherFile.txt /path/to/directory/anotherFile.txt
*/
Source : | Last Update : Sat, 31 Jul 21