note 118255 deleted from function.scandir by cmb
| From: | cmb@php.net | Date: | Wed, 16 Dec 2015 16:04:32 +0000 |
| Subject: | note 118255 deleted from function.scandir by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204419@lists.php.net to get a copy of this message | ||
Note Submitter: sharshun dot aliaksandr at gmail dot com
----
<?php
function glob_recursive($pattern, $flags = 0){
// forked from https://github.com/rodurma/PHP-Functions/
// blob/master/glob_recursive.php
$files = glob($pattern, $flags);
foreach (glob(dirname($pattern).'/*',
GLOB_ONLYDIR|GLOB_NOSORT) as $dir){
$files = array_merge($files, glob_recursive
($dir.'/'.basename($pattern), $flags));
}
return $files;
}
// $a=glob_recursive('c:/test_directory/'."*.*");
// print_r($a);
function dirInfoReGet($s){
$a=glob_recursive($s."*.*");
$ar=glob_recursive($s."**/**");
$arr=array_unique(array_merge($a, $ar));
foreach ($arr as $v) {
if (is_dir($v)) {
$arra[0][]=$v.'/';
} else {
$arra[1][]=$v;
}
}
sort($arra);
return $arra;
}
$a=dirInfoReGet('c:/test_directory/');
print_r($a);
?>
http://i.stack.imgur.com/H7UF3.jpg
Best regards.