-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
54 lines (46 loc) · 1.14 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
/**
* @author Eugene Santos
* @email [email protected]
*/
class Dir
{
private $_dirlist = array();
function __construct()
{
}
public function traverse($path = '.')
{
// just list all the directories in a directory :)
$path_list = glob($path.'/*', GLOB_ONLYDIR);
$this->_dirlist[$path] = glob($path.'/*');
if ( empty ($path_list) )
{
return;
}
else
{
foreach ( $path_list as $key => $value )
{
if ($path !== '.')
{
//just the child dirs
$this->traverse($path.'/'. substr($value, strlen($path)+1 ) );
}
else
{
$this->traverse($value);
}
}
}
}
public function getDirlist()
{
return $this->_dirlist;
}
}
echo '<pre>';
$dir = new Dir;
$dir->traverse('.');
print_r($dir->getDirlist());
?>