You are here

function imce_get_subfolders in IMCE 5

scan directory and return folders matching expression.

1 call to imce_get_subfolders()
imce_create_subfolders in ./imce.module
create folder(s) under root according to path.

File

./imce.module, line 884

Code

function imce_get_subfolders($dir, $expr = '') {
  $folders = array();
  if ($handle = @opendir($dir)) {
    while (($file = readdir($handle)) !== FALSE) {
      if ($file != '.' && $file != '..' && is_dir($dir . '/' . $file) && preg_match('/^' . $expr . '$/', $file)) {
        $folders[] = $dir . '/' . $file;
      }
    }
    closedir($handle);
  }
  return $folders;
}