Ciao,
in internet ho trovato uno script che fa al caso tuo, e l'ho modificato per trovare solo cartelle
Codice PHP:
function getDirectory( $path = '.', $level = 0 ){
$ignore = array( '.', '..' );
$dh = @opendir( $path );
while( false !== ( $file = readdir( $dh ) ) ){
if( !in_array( $file, $ignore ) ){
$spaces = str_repeat( '', ( $level * 4 ) );
if( is_dir( "$path/$file" ) ){
echo "[b]$spaces $file[/b]
";
getDirectory( "$path/$file", ($level+1) );
} else {
}
}
}
closedir( $dh );
}
Esempio:
Codice PHP:
$actual_dir = dirname( __FILE__ );
getDirectory( $actual_dir );