First, create an instance of the RecursiveDirectoryIterator,with the parameter set to the path of your base directory you are inspecting.
Then, using a foreach loop, use RecursiveIteratorIterator to inspect each file and do whatever logic you would like to on them.
Code:
<?php $di = new RecursiveDirectoryIterator('path/to/directory'); foreach (new RecursiveIteratorIterator($di) as $filename => $file) { echo $filename . ' - ' . $file->getSize() . ' bytes <br/>'; }
?>
One more blog to lesezeichen, ill end up being keeping tabs on this
ReplyDeleteThanks , this was just what I needed
ReplyDelete