/ Published in: PHP
Expand |
Embed | Plain Text
<?php /** * PHP5 - Fast, recursive, directory profiler * @param string $dir Path to a readable directory path * @version 1.0 */ function profile( $dir ) { foreach( scandir( $dir) as $item ) { if( $item != "." && $item != ".." ) { $info['all'][] = $absPath = $dir . DIRECTORY_SEPARATOR . $item; switch( $stat['mode'] & 0170000 ) { case 0010000: $info['files'][] = $absPath; break; case 0040000: $info['directories'][] = $absPath; profile( $absPath ); break; case 0120000: $info['links'][] = $absPath; break; case 0140000: $info['sockets'][] = $absPath; break; case 0010000: $info['pipes'][] = $absPath; break; } } } } return $info; } ?>
You need to login to post a comment.
