Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function scan($path,&$res, $type="*",
- $type_sort="small", $lines=0) {
- $mass=scandir($path);
- for($i=0;$i<=count($mass)-1;$i++) {
- if($mass[$i]!=".." &&
- $mass[$i]!=".") {
- if(strtolower($type_sort)=="small")
- {
- if($type=="*" || strstr(strtolower($mass[$i]),$type))
- array_push($res,array($lines,$mass[$i]));
- } else
- if($type=="*" || strstr(strtolower($mass[$i]),$type))
- array_push($res,array($lines,$path.$mass[$i]));
- } if(!strstr($mass[$i],"."))
- if(is_dir($path.'/'.$mass[$i]))
- scan($path.'/'.$mass[$i],$res,$type,$type_sort,$lines+1);
- }
- }
- function scan( $path, $ex = '*', $type_sort = 'small', $level = 0 ){
- $res = Array();
- $files = scandir( $path );
- $path_add = ( strtolower( $type_sort ) == 'small' ) ? $path : '';
- for ( $i = 0; $i < count( $files ); $i++ ){
- if ( $files[$i] != ".." && $files[$i] != "." ) {
- if ( $ex == "*" || strstr( strtolower( $files[$i] ), $ex ) ){
- $res[] = array( $level, $path_add . $files[$i] );
- }
- }
- if ( !strstr( $files[$i], "." ) && is_dir( $path.'/'.$files[$i] ) ){
- array_merge(
- scan( $path.'/'.$files[$i], $ex, $type_sort, $level + 1 );
- );
- }
- }
- return $res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement