Returns a list of the child directories of the given parent directory
495715
def _get_sub_dirs(parent):
    """"""
    return [child for child in os.listdir(parent) if os.path.isdir(os.path.join(parent, child))]
885839
public function getParentDirectories()
    {
        if ($this->isCurrentDirectoryBase()) {
            return [];
        }

        $currentDir = $this->currentDir;
        $dirs = [];
        do {
            $dir = dirname($currentDir);
            $dirs[] = $this->getPathRelativeToBaseDir($dir)
                ?: DIRECTORY_SEPARATOR;
            $currentDir = $dir;
        } while ($dir !== $this->baseDir);

        return array_reverse($dirs);
    }
1177864
def get_subdirs(directory):
    
    return [os.path.join(directory, name)
            for name in os.listdir(directory)
            if os.path.isdir(os.path.join(directory, name))]
630444
def DirectoriesRelative(self):
        
        # Acquire all directories
        directories = itertools.chain(self.Directories, (os.path.dirname(f) for f in itertools.chain(self.ContentFiles, self.CompileFiles)))
        directories = set(os.path.relpath(d, self.ProjectHome) for d in directories)

        # We need separate entries for parent directories of directories in the list
        for path in set(directories):
            subpath = os.path.dirname(path)
            while subpath:
                directories.add(subpath)
                subpath = os.path.dirname(subpath)

        return sorted(directories)
1081301
def collect_dirs(path, max_depth=1, followlinks=True):
    """"""

    if not os.path.isdir(path):
        return []

    o = [path]

    if max_depth == 0:
        return o

    for subdir in os.listdir(path):

        subdir = os.path.join(path, subdir)

        if not os.path.isdir(subdir):
            continue

        o += [subdir]

        if os.path.islink(subdir) and not followlinks:
            continue

        if max_depth > 0:
            o += collect_dirs(subdir, max_depth=max_depth - 1)

    return list(set(o))
216369
def get_file_list(self):
        
        if os.path.isdir(self.root_path):
            return [os.path.join(self.root_path, f) for f in os.listdir(self.root_path)
                    if os.path.isfile(os.path.join(self.root_path, f))]
        else:
            return [self.root_path]
806834
def finddirs(root):
    """"""
    retval = []
    for root, dirs, files in os.walk(root):
        for d in dirs:
            retval.append(os.path.join(root, d))
    return retval
1133798
def dirs(self):
        """"""
        contents = self.paths
        contents = (VenvDir(path.path) for path in contents if path.is_dir)
        return contents
1009570
function getFolders(dir) {
  try {
    return fs.readdirSync(dir)
      .filter(function (file) {
        return exports.isDirectory(path.join(dir, file));
      });
  } catch (ex) {
    return [];
  }
}
394746
def make_parent_dirs(path, mode=0o777):
  
  parent = os.path.dirname(path)
  if parent:
    make_all_dirs(parent, mode)
  return path
1303129
def parent_dir(path):
    ''''''
    return os.path.abspath(os.path.join(path, os.pardir, os.pardir, '_build'))
322715
def list_all_directories(self):
        
        def list_dirs_recursively(directory):
            if directory == self.filesystem:
                yield directory
            d_gen = itertools.chain(
                directory.directories,
                *tuple(list_dirs_recursively(d)
                       for d in directory.directories))
            for d in d_gen:
                yield d
        return list_dirs_recursively(self.filesystem)
829106
function mkdirIf(dir, parent) {
	var path = parent ? parent : ".";
	if (getDirectories(path).indexOf(dir) == -1) fs.mkdirSync(path + "/" + dir);
}
1340931
private static List<File> findPythonLibDirectories(File parentDirectory) {
        List<File> foundDirectories = new ArrayList<>();
        if (parentDirectory != null && parentDirectory.exists()) {
            for (File dir : parentDirectory.listFiles(DIRECTORY_FILE_FILTER)) {
                if (dir.getName().equals("pythonlib")) {
                    foundDirectories.add(dir);
                } else {
                    foundDirectories.addAll(findPythonLibDirectories(dir));
                }
            }
        }
        return foundDirectories;
    }
1255698
def listdir(self, pathobj):
        
        stat = self.stat(pathobj)

        if not stat.is_dir:
            raise OSError(20, "Not a directory: %s" % str(pathobj))

        return stat.children
84662
def get_parent_path(index=2):  # type: (int) -> str
    
    try:
        path = _caller_path(index)
    except RuntimeError:
        path = os.getcwd()
    path = os.path.abspath(os.path.join(path, os.pardir))
    return path
1128746
def find_directories(root, pattern):
    
    results = []
    for base, dirs, files in os.walk(root):
        matched = fnmatch.filter(dirs, pattern)
        results.extend(os.path.join(base, d) for d in matched)
    return results