Getting a List of All Files in a Directory


You want to pull a list of all files in a directory.


Use the File::files() method.

$files = File::files();


This method always returns an array.

The array only contains files, no directories.

If no files are found in the directory, or the directory doesn't exist, an empty array is returned.

comments powered by Disqus