liststatus returns the children of a directory
after looking up the index files.
551965
@Override
  public FileStatus[] listStatus(Path f) throws IOException {
    //need to see if the file is an index in file
    //get the filestatus of the archive directory
    // we will create fake filestatuses to return
    // to the client
    List<FileStatus> statuses = new ArrayList<FileStatus>();
    FileStatus archiveStatus = fs.getFileStatus(archiveIndex);
    Path tmpPath = makeQualified(f);
    Path harPath = getPathInHar(tmpPath);
    String readStr = fileStatusInIndex(harPath);
    if (readStr == null) {
      throw new FileNotFoundException("File " + f + " not found in " + archivePath);
    }
    HarStatus hstatus = new HarStatus(readStr,archiveStatus, version);
    if (!hstatus.isDir()) {
        statuses.add(new FileStatus(hstatus.getLength(),
            hstatus.isDir(),
            archiveStatus.getReplication(), archiveStatus.getBlockSize(),
            hstatus.getModificationTime(), hstatus.getAccessTime(),
            new FsPermission(hstatus.getPermission()),
            hstatus.getOwner(), hstatus.getGroup(),
            makeRelative(this.uri.getPath(), new Path(hstatus.getName()))));
    } else {
      fileStatusesInIndex(hstatus, statuses, hstatus.getChildren(), archiveStatus);
    }
    return statuses.toArray(new FileStatus[statuses.size()]);
  }
431669
function listdir(dir, rules, root, included) {
  return fs.readdir(dir)
  .then(function(files) {
    return when.all(files.map(function(f) {
      f = path.join(dir, f);
      return when(fs.stat(f), function(stat) {
        return {
          path: f,
          isDirectory: stat.isDirectory()
        };
      });
    }));
  })
  .then(function(arr) {
    var files = [];
    var subdirs = [];
    arr.forEach(function(e) {
      if (e.isDirectory) {
        subdirs.push(e.path);
      } else {
        files.push(e.path);
      }
    });
    files = files.filter(function(f) {
      return filter(f, rules, root, false, included);
    });
    return when.all(subdirs.map(function(d) {
      return listdir(d, rules, root, filter(d, rules, root, true, included));
    }))
    .then(function(list) {
      list = list.reduce(function(ret, i) {
        return ret.concat(i);
      }, files);
      // include current dir only if at least one of its children is included
      if (list.length > 0) {
        list.push(dir);
      }
      return list;
    });
  });
}
1072870
public static ArrayList<Path> listFilesByModificationTime(FileSystem fs, Path directory, long olderThan)
          throws IOException {
    ArrayList<LocatedFileStatus> fstats = new ArrayList<>();

    RemoteIterator<LocatedFileStatus> itr = fs.listFiles(directory, false);
    while( itr.hasNext() ) {
      LocatedFileStatus fileStatus = itr.next();
      if(olderThan>0) {
        if( fileStatus.getModificationTime()<=olderThan )
          fstats.add(fileStatus);
      }
      else {
        fstats.add(fileStatus);
      }
    }
    Collections.sort(fstats, new ModifTimeComparator() );

    ArrayList<Path> result = new ArrayList<>(fstats.size());
    for (LocatedFileStatus fstat : fstats) {
      result.add(fstat.getPath());
    }
    return result;
  }
328075
def dfs_get_all_childs(self, root):
        
        self.nodes[root]['dfs_loop_status'] = 'DFS_CHECKED'

        ret = set()
        # Me
        ret.add(root)
        # And my sons
        ret.update(self.nodes[root]['sons'])

        for child in self.nodes[root]['sons']:
            # I just don't care about already checked children
            if self.nodes[child]['dfs_loop_status'] == 'DFS_UNCHECKED':
                ret.update(self.dfs_get_all_childs(child))

        return list(ret)
677663
public final synchronized void findFiles(File directory, FileFilter filter, Collection<? super File> fileOut) {
		if (directory != null && filter != null) {
			File candidate;
			final List<File> candidates = new ArrayList<>();

			final String relativePath = removePathPrefix(getBaseDirectory(), directory);

			getLog().debug("Retreiving " //$NON-NLS-1$
					+ filter.toString() + " files from " //$NON-NLS-1$
					+ relativePath);

			candidates.add(directory);
			int nbFiles = 0;

			while (!candidates.isEmpty()) {
				candidate = candidates.remove(0);
				if (candidate.isDirectory()) {
					final File[] children = candidate.listFiles(filter);
					if (children != null) {
						for (final File child : children) {
							if (child != null && child.isDirectory()) {
								candidates.add(child);
							} else {
								fileOut.add(child);
								++nbFiles;
							}
						}
					}
				}
			}

			getLog().debug("Found " //$NON-NLS-1$
					+ nbFiles + " file(s)"); //$NON-NLS-1$
		}
	}
226386
def indexlist( self ):
        
        output = [(child.text(0), child.url())
                   for child in self.children(recursive=True)]
        
        output.sort()
        return output
676562
def listdir(self, directory_path=None, hidden_files=False):
        
        # Change current directory if a directory path is specified, otherwise use current
        if directory_path:
            self.chdir(directory_path)

        # Exclude hidden files
        if not hidden_files:
            return [path for path in self.session.nlst() if not path.startswith('.')]

        # Include hidden files
        else:
            return self.session.nlst()
447215
def searchHierarchy(self, fparent):
		""""""
		data = []
		returnData = []
		parentslashes = fparent.count('/') 
		filecount = 0
		foldercount = 0

		#open files for folder searching
		try:
			dirFile = open(self.dirIndex, 'rt')
		except IOError:
			self.repo.printd("Error: Unable to read index file " + self.dirIndex)
			return

		#search for folders
		for fldr in dirFile:
			fldr = fldr.split('|')
			fldr = fldr[0]
			if fparent in fldr and parentslashes+1 == fldr.count('/'):
				returnData.append([fldr, fldr[fldr.rfind('/',1,-1):-1], ResultType.FOLDER])
				foldercount += 1

		dirFile.close()

		#open files for file searching
		try:
			fileFile = open(self.fileIndex, 'rt')
		except IOError:
			self.repo.printd("Error: Unable to read index file " + self.fileIndex)
			return

		try:
			nameFile = open(self.nameIndex, 'rt')
		except IOError:
			self.repo.printd("Error: Unable to read index file " + self.nameIndex)
			return

		#search for files
		for (path,name) in zip(fileFile,nameFile):
			if fparent in path and parentslashes == path.count('/'):
				returnData.append([path.strip(), name, ResultType.FILE])
				filecount += 1

		fileFile.close()
		nameFile.close()

		return [returnData, foldercount, filecount]
1369605
private FileStatusEntry[] doListPathsEntry(Path path, FileStatusEntry entry)
      throws IOException {
    final Path[] paths = listPaths(path);

    final FileStatusEntry[] children =
        paths.length > 0 ? new FileStatusEntry[paths.length] : FileStatusEntry.EMPTY_ENTRIES;
    for (int i = 0; i < paths.length; i++) {
      children[i] = createPathEntry(entry, paths[i]);
    }
    return children;
  }
1233942
def _get_files_recursively(rootdir):
    
    output = []
    for root, dirs, files in os.walk(rootdir):
        for filename in files:
            output.append(os.path.join(root, filename))

    return output
145768
def get_child_files(path):
        '''  '''
        path = FileHelper.abspath(path)
        return [filename for filename in os.listdir(path) if os.path.isfile(os.path.join(path, filename))]
924286
function getLocalNodeFiles(dir) {
    dir = path.resolve(dir);

    var result = [];
    var files = [];
    var icons = [];
    try {
        files = fs.readdirSync(dir);
    } catch(err) {
        return {files: [], icons: []};
    }
    files.sort();
    files.forEach(function(fn) {
        var stats = fs.statSync(path.join(dir,fn));
        if (stats.isFile()) {
            if (/\.js$/.test(fn)) {
                var info = getLocalFile(path.join(dir,fn));
                if (info) {
                    result.push(info);
                }
            }
        } else if (stats.isDirectory()) {
            // Ignore /.dirs/, /lib/ /node_modules/
            if (!/^(\..*|lib|icons|node_modules|test|locales)$/.test(fn)) {
                var subDirResults = getLocalNodeFiles(path.join(dir,fn));
                result = result.concat(subDirResults.files);
                icons = icons.concat(subDirResults.icons);
            } else if (fn === "icons") {
                var iconList = scanIconDir(path.join(dir,fn));
                icons.push({path:path.join(dir,fn),icons:iconList});
            }
        }
    });
    return {files: result, icons: icons};
}
176143
FileStatus[] getListing(String src) {
    String srcs = normalizePath(src);
    byte[][] components = INodeDirectory.getPathComponents(srcs);
    readLock();
    try {
      INode targetNode = rootDir.getNode(components);
      if (targetNode == null)
        return null;
      if (!targetNode.isDirectory()) {
        return new FileStatus[]{createFileStatus(
        		src, targetNode)};
      }
      List<INode> contents = ((INodeDirectory)targetNode).getChildren();
      if(! srcs.endsWith(Path.SEPARATOR))
    	  srcs += Path.SEPARATOR;
      FileStatus listing[] = new FileStatus[contents.size()];
      int i = 0;
      for (INode cur : contents) {
        listing[i] = createFileStatus(srcs+cur.getLocalName(), cur);
        i++;
      }
      return listing;
    } finally {
      readUnlock();
    }
  }
581033
private FileStatus[] listStatus(FTPClient client, Path file)
      throws IOException {
    Path workDir = new Path(client.printWorkingDirectory());
    Path absolute = makeAbsolute(workDir, file);
    FileStatus fileStat = getFileStatus(client, absolute);
    if (!fileStat.isDir()) {
      return new FileStatus[] { fileStat };
    }
    FTPFile[] ftpFiles = client.listFiles(absolute.toUri().getPath());
    FileStatus[] fileStats = new FileStatus[ftpFiles.length];
    for (int i = 0; i < ftpFiles.length; i++) {
      fileStats[i] = getFileStatus(ftpFiles[i], absolute);
    }
    return fileStats;
  }
92982
private static int index(File indexDir, File dataDir) 
        throws IOException {
        if (!dataDir.exists() || !dataDir.isDirectory()) {
            throw new IOException(dataDir
                    + " does not exist or is not a directory");
        }

        IndexWriter writer = new IndexWriter(indexDir,
                    new StandardAnalyzer(), true, IndexWriter.MaxFieldLength.UNLIMITED);
        writer.setUseCompoundFile(false);

        indexDirectory(writer, dataDir);

        int numIndexed = writer.numDocs();
        writer.optimize();
        writer.close();
        return numIndexed;
    }
788509
function getDirectories(source) {
  const isDirectory = sourcePath => lstatSync(sourcePath).isDirectory()
  return readdirSync(source)
    .map(name => join(source, name))
    .filter(isDirectory)
}
103237
@Nullable
  private FileStatus[] listStatusInternal(String path) throws IOException {
    FileStatus[] files;
    FileSystem hdfs = getFs();
    try {
      files = hdfs.listStatus(new Path(path));
    } catch (FileNotFoundException e) {
      return null;
    }
    // Check if path is a file
    if (files != null && files.length == 1 && files[0].getPath().toString().equals(path)) {
      return null;
    }
    return files;
  }