Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. function dirFinder ($folder)
  2. {
  3. $all_in_folder = scandir($folder);
  4. foreach ($all_in_folder as $object) {
  5. if ($object == '.' || $object == '..') continue;
  6. $path_to_object = "$folder" . DIRECTORY_SEPARATOR . "$object";
  7. if (is_dir($path_to_object)) {
  8. yield $path_to_object;
  9. dirFinder($path_to_object);
  10. }
  11. }
  12. }
  13.  
  14. foreach (dirFinder('C:Test') as $value) {
  15. echo $value . '<br />';
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement