Filtering a recursive iterator generally involves two conditions.
The first is that, to allow recursion, the callback function should return TRUE
if the current iterator item has children.
The second is the normal filter condition, such as a file size or extension
check as in the example below.

Note that the following filters out both files and directories whos names start with the letter "T". The important thing here is that since the function returns false for a directory entry whos name starts with T, the directory is also not traversed recursively.