Recursively Scan a Directory Using PHP SPL Directory Iterator

Recursively scan a Root folder and ALL it’s sub-folders using PHP’s SPL DirectoryIterator class. This example shows how to get a Image Files under a certain folder recursively but can easily be used to get any or all types of files.

The Code

The Result