($value, $key, $it) { return ($value->isDir() || $value->getSize() < 1024); }); $it = new RecursiveIteratorIterator($it); $it = new CallbackFilterIterator($it, function ($value, $key, $it) { return ! $value->isDir(); }); foreach ($it as $item) { print $item->getSize() . “ “ . $item->getPathName().”\n”; }