List files and directories
420627
def listdir(path, include=r'.', exclude=r'\.pyc$|^\.', show_all=False,
            folders_only=False):
    """"""
    namelist = []
    dirlist = [to_text_string(osp.pardir)]
    for item in os.listdir(to_text_string(path)):
        if re.search(exclude, item) and not show_all:
            continue
        if osp.isdir(osp.join(path, item)):
            dirlist.append(item)
        elif folders_only:
            continue
        elif re.search(include, item) or show_all:
            namelist.append(item)
    return sorted(dirlist, key=str_lower) + \
           sorted(namelist, key=str_lower)
968324
function (dir) {
    let files = [];
    let list = fs.readdirSync(dir);
    list.forEach(function (file) {
        file = dir + '/' + file;
        let stat = fs.statSync(file);
        if (stat && stat.isDirectory()) files = files.concat(walk(file));
        else files.push(file);
    });
    return files;
}
964612
def ListFiles(self, ext_attrs=None):
    """"""
    del ext_attrs  # Unused.

    if not self.IsDirectory():
      raise IOError("%s is not a directory" % self.pathspec.CollapsePath())

    for f in self.fd.as_directory():
      try:
        name = _DecodeUTF8WithWarning(f.info.name.name)
        # Drop these useless entries.
        if name in [".", ".."] or name in self.BLACKLIST_FILES:
          continue

        # First we yield a standard response using the default attributes.
        yield self.MakeStatResponse(f, tsk_attribute=None, append_name=name)

        # Now send back additional named attributes for the ADS.
        for attribute in f:
          if attribute.info.type in [
              pytsk3.TSK_FS_ATTR_TYPE_NTFS_DATA, pytsk3.TSK_FS_ATTR_TYPE_DEFAULT
          ]:
            if attribute.info.name:
              yield self.MakeStatResponse(
                  f, append_name=name, tsk_attribute=attribute)
      except AttributeError:
        pass
421491
def list_dirs(directory):
    
    return [f for f in pathlib.Path(directory).iterdir() if f.is_dir()]
1335636
def _listdir(self, path):
        """"""
        if self._user is None:
            return os.listdir(path)
        else:
            args = self._build_cmdline(['/bin/ls', '-1A', path])
            return subprocess.check_output(args, stderr=DEVNULL).decode('utf-8', errors='ignore').split('\n')
408773
function getFiles(dir) {
    var files = [];

    var traverse = function (dir) {
        var dirList = dir.listFiles();
        dirList.forEach(function (file) {
            if (/\.css$/.test(file)) {
                files.push(file);
            } else if (file.isDirectory()) {
                traverse(file);
            }
        });
    };

    traverse(dir);

    return files;
}
531167
def listAllFiles (directory, suffix=None, abspath=False):
    
    files = []

    directory = expandPath(directory)

    for dirpath, dirnames, filenames in os.walk(directory, followlinks=True):
        if suffix:
            filenames = [f for f in filenames if f.endswith(suffix)]

        for filename in filenames:
            filepath = os.path.join(dirpath, filename)
            if not abspath:
                filepath = os.path.relpath(filepath, start=directory)

                # os.path.join(path, filename)

            files.append(filepath)

    return files
86264
def list_files(scan_path, contains=None):
    
    file_list = []
    path = os.path.abspath(scan_path)
    for f in sorted(os.listdir(path)):
        if contains and f.find(contains) < 0:
            continue
        filepath = os.path.join(path, f)
        if os.path.isfile(filepath):
            file_list.append(filepath)
    return file_list
986443
def list_dir_all(cookie, tokens, path):
    ''''''
    pcs_files = []
    page = 1
    while True:
        content = list_dir(cookie, tokens, path, page)
        if not content:
            return (path, None)
        if not content['list']:
            return (path, pcs_files)
        pcs_files.extend(content['list'])
        page = page + 1
182741
def listdir(self, path, **kwargs):
        """"""
        statuses = self.list_status(path, **kwargs)
        if len(statuses) == 1 and statuses[0].pathSuffix == '' and statuses[0].type == 'FILE':
            raise NotADirectoryError('Not a directory: {!r}'.format(path))
        return [f.pathSuffix for f in statuses]
914247
def _listdir(self, root):
        ""
        res = []
        for name in os.listdir(root):
            path = os.path.join(root, name)
            if os.path.isdir(path):
                name += os.sep
            res.append(name)
        return res
541737
def _list_files(self, path):
        """"""
        files = []
        for f in glob.glob(pathname=path):
            files.append(f)
        files.sort()
        return files
422571
def _list_dir(self):
        
        return [os.path.join(self._path, fn) for fn in os.listdir(self._path)
                if not fn.endswith(self._fs_transaction_suffix)]
1269622
def file_list( files )
    case files
    when String
      [files]
    when Array
      files
    when Proc
      files.call # result should respond to #each
    else
      []
    end
  end
454376
def list_files(path = Dir.pwd)
      g = MiniGit.new(path)
      g.capturing.ls_files.split
    end
309170
function systemListing($mask, $directory, $key = 'name', $min_depth = 1) {
    $files = array();
    foreach (\Drupal::moduleHandler()->getModuleList() as $name => $module) {
      $files += file_scan_directory($module->getPath(), $mask, array('key' => $key));
    }
    return $files;
  }
782644
def listFiles(self):
        
        def fn(dirName, level, files):
            if level == self.levelNo-1:
                for fileName in os.listdir(dirName):
                    if fileName != "lock":
                        absFileName = os.path.join(dirName, fileName)
                        files.append(absFileName)
            else:
                for subDir in os.listdir(dirName):
                    if subDir != "lock":
                        absDirName = os.path.join(dirName, subDir)
                        assert os.path.isdir(absDirName)
                        fn(absDirName, level+1, files)
        files = []
        fn(self.rootDir, 0, files)
        return files