Getting the names of all files in a directory with PHP January 7, 2023 by Tarik Don’t bother with open/readdir and use glob instead: foreach(glob($log_directory.'/*.*') as $file) { ... }