I have the recursive iterator overview, I get all the files but also all the directory's. I want only a overview of the files. I have this code below:
<?php
$root = '/xampp/htdocs/systeembeheer/Storage/download/';
$iter = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($root, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::SELF_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
);
$paths = array($root);
foreach ($iter as $path => $dir) {
if ($dir->isDir()) {
$paths[] = $path;
}
}
?>
You can use File (Illuminate\Support\Facades\File) facade:
foreach (File::allFiles($root) as $file) {
// $file->getFilename()
}
API: https://laravel.com/api/5.2/Illuminate/Contracts/Filesystem/Filesystem.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With