Returns all directories in a given directory
421491
def list_dirs(directory):
    
    return [f for f in pathlib.Path(directory).iterdir() if f.is_dir()]
356878
public function directories($directory)
    {
        return collect($this->filesystem->directories($directory))
            ->map(function ($file) {
                return new File($file, $this);
            });
    }
305823
private static Set<File> findAllFiles(File dir) {
        Set<File> foundFiles = new HashSet<>();
        if (dir == null) {
            return foundFiles;
        }
        recurse(dir, foundFiles);
        return foundFiles;
    }
395873
def get_files(directory, recursive=False):
    """"""
    files_out = []
    if recursive:
        for root, dirs, files in os.walk(os.path.abspath(directory)):
            files = [os.path.join(root, f) for f in files]
            files_out.append(files)
        files_out = list(itertools.chain(*files_out))
    else:
        files_out = [os.path.join(directory, f) for f in os.listdir(directory)]
        files_out = list(filter(lambda f: os.path.isfile(f), files_out))

    # order alphabetically on file name
    return sorted(files_out)
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)
649533
public function directories($directory, $pattern = '*')
    {
        $all = array_filter($this->listDirectory($directory), function ($path) {
            return $this->type($path) == 'dir';
        });

        return $this->filterPaths($all, $pattern);
    }
995076
def all_files(file_or_directory):
    ''
    if os.path.isdir(file_or_directory):
        return [os.path.join(dirname, filename)
                for dirname, dirnames, filenames in os.walk(file_or_directory)
                for filename in filenames]
    else:
        return [file_or_directory]
1151230
def _get_emptydirs(self, files):
        ''''''
        emptydirs = []
        for f in files:
            if self._is_dir(f):
                empty = True
                for ff in files:
                    if ff.startswith(f + '/'):
                        empty = False
                        break
                if empty:
                    emptydirs.append(f)
        return emptydirs
745169
def dirs(self):
        """"""
        contents = self.paths
        contents = (BinDir(path.path) for path in contents if path.is_dir)
        return contents
729666
def get_files (dirname):
    """"""
    for entry in os.listdir(dirname):
        fullentry = os.path.join(dirname, entry)
        if os.path.islink(fullentry):
            continue
        if os.path.isfile(fullentry):
            yield entry
        elif os.path.isdir(fullentry):
            yield entry+"/"
1007554
def path_only_contains_dirs(self, path):
        """"""
        pathlistdir = os.listdir(path)
        if pathlistdir == []:
            return True
        if any(os.path.isfile(os.path.join(path, i)) for i in pathlistdir):
            return False
        return all(self.path_only_contains_dirs(os.path.join(path, i)) for i in pathlistdir)
1075168
def _walk_directory(root_directory):
        

        paths = [os.path.join(root, name)
                 for root, dirs, files in os.walk(root_directory)  # noqa
                 for name in files]
        paths.sort()
        return paths
564967
private static Collection<File> findDirsRecursively(File dir) {
		return FileUtils.listFilesAndDirs(dir, FalseFileFilter.FALSE, TrueFileFilter.TRUE);
	}
276520
function getFiles(folder = srcFolder){
  let all = [];
  let f = fs.readdirSync(folder);
  for(file of f){
    all.push(path.join(folder,file))
    if(fs.lstatSync(path.join(folder,file)).isDirectory()){
      all = all.concat(getFiles(path.join(folder,file)));
    }
  }
  return all;
}
95688
def _get_dirs(user_dir, startup_dir):
    '''
    
    '''
    try:
        users = os.listdir(user_dir)
    except WindowsError:  # pylint: disable=E0602
        users = []

    full_dirs = []
    for user in users:
        full_dir = os.path.join(user_dir, user, startup_dir)
        if os.path.exists(full_dir):
            full_dirs.append(full_dir)
    return full_dirs
1257738
def find_clean_dirs(self):
        """"""

        for folder in glob.glob(self.glob_pattern):
            if re.match(self.re_pattern, folder):
                yield folder
        for folder in glob.glob(self.orig_glob_pattern):
            if re.match(self.orig_re_pattern, folder):
                yield folder
471083
private ArrayList<String> getFiles(String dir, String subDir) {
    ArrayList<String> files = new ArrayList<>();
    String fullDir = subDir == null ? dir : dir + File.separator + subDir;
    File[] listOfFiles = (new File(fullDir)).listFiles();
    if (listOfFiles != null) {
      for (File file : listOfFiles) {
        String fullName = subDir == null ? file.getName() : subDir + File.separator + file.getName();
        if (file.isFile()) {
          files.add(fullName);
        } else if (file.isDirectory()) {
          files.addAll(getFiles(dir, fullName));
        }
      }
    }
    return files;
  }