public function expandDirectories($baseDir) {
        $directories = array();
        foreach (scandir($baseDir) as $file) {
            if ($file == '.' || $file == '..')
                continue;
            $dir = $baseDir . DS . $file;
            if (is_dir($dir)) {
                $directories [] = $dir;
                $directories = array_merge($directories, $this->expandDirectories($dir));
            }
        }
        return $directories;
    }