/ Published in: PHP
URL: http://www.php.net/manual/en/function.glob.php
To get all files in a directory:
$fileList = rglob("*", GLOB_MARK, '/path/to/dir');
foreach($fileList as $index => $file) { if($file[strlen($file) - 1] != "/") { // then it is a file } }
Expand |
Embed | Plain Text
rglob($pattern, $flags = 0, $path = '') { if ($dir == '\\' || $dir == '/') $dir = ''; } return $files; }
Comments
Subscribe to comments
You need to login to post a comment.

This has to fail - you are calling rglob() several times inside itself. (line 4 and again in line 8)
Nice use of recursion.
iroybot... if you don't really understand recursion, you are likely not to want to touch this.
Latest version is found here