note 123777 added to class.recursivedirectoryiterator

From: Date: Mon, 15 Apr 2019 03:50:03 +0000
Subject: note 123777 added to class.recursivedirectoryiterator
Groups: php.notes 
Request: Send a blank email to php-notes+get-210600@lists.php.net to get a copy of this message
if you want to show the all files from all directories you have to follow it- $dir = new RecursiveDirectoryIterator(getcwd()); $files = new RecursiveIteratorIterator($dir); foreach($files as $file){ echo $file->getFileName(); echo PHP_EOL; // for new line } Now, if you want to show the full path, then follow this- $dir = new RecursiveDirectoryIterator(getcwd()); $files = new RecursiveIteratorIterator($dir); foreach($files as $file){ echo $file->getPath().$file->getFileName(); echo PHP_EOL; } If you want to skip the dots, you need to change the first line with this- $dir = new RecursiveDirectoryIterator(getcwd(), RecursiveDirectoryIterator::SKIP_DOTS); ---- Server IP: 208.43.231.9 Probable Submitter: 82.199.130.26 (proxied: 42.0.5.226) ---- Manual Page -- http://php.net/manual/en/class.recursivedirectoryiterator.php Edit -- https://master.php.net/note/edit/123777 Del: integrated -- https://master.php.net/note/delete/123777/integrated Del: useless -- https://master.php.net/note/delete/123777/useless Del: bad code -- https://master.php.net/note/delete/123777/bad+code Del: spam -- https://master.php.net/note/delete/123777/spam Del: non-english -- https://master.php.net/note/delete/123777/non-english Del: in docs -- https://master.php.net/note/delete/123777/in+docs Del: other reasons-- https://master.php.net/note/delete/123777 Reject -- https://master.php.net/note/reject/123777 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#210600) next »