06-03-2010, 09:09 PM
|
#7 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
The following may not be the prettiest but it seems to get the job done - tested on a directory containing roughly 50,000+ files; 3-4 seconds execution time. If you're still timing out, you could a) change the timeout in php.ini, b) change it in your .htaccess or c) use set_time_limit(0)
php Code:
$iterator = new RecursiveDirectoryIterator ( $directory ); $dirs = array(); foreach ( new RecursiveIteratorIterator ( $iterator ) as $d ) $dirs[] = $d-> getPath(); print_r( array_unique( $dirs ) );
|
|
|
|