Skip to content

Instantly share code, notes, and snippets.

@quilime
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quilime/cbc77d61f3280d3f2dd3 to your computer and use it in GitHub Desktop.
Save quilime/cbc77d61f3280d3f2dd3 to your computer and use it in GitHub Desktop.
<?php
function get_patches($dir) {
global $c, $inc, $offset_left, $offset_top;
$inc = 0;
$dir_array = [];
$path = realpath($dir);
$dirs = new RecursiveDirectoryIterator($path, RecursiveDirectoryIterator::SKIP_DOTS);
$objects = new RecursiveIteratorIterator($dirs, RecursiveIteratorIterator::SELF_FIRST);
$section = basename($dir);
// script_header($section);
// filter unique paths: loop through all objects and store names in dir_array
foreach($objects as $name => $object){
$basename = $object->getBasename();
if($object->isDir() && $basename[0] != '.') {
array_push($dir_array, $name);
}
}
return $dir_array;
}
$result = get_patches('CNMAT-MMJ-Depot-master/examples/demos/');
print_r($result);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment