@Test public void testListPathsRecursively() throws IOException { FileSystem localFs = FileSystem.getLocal(new Configuration()); Path baseDir = new Path(FILE_UTILS_TEST_DIR, "fileListTestDir2"); try { if (localFs.exists(baseDir)) { localFs.delete(baseDir, true); } localFs.mkdirs(baseDir); localFs.create(new Path(baseDir, TEST_FILE_NAME1)); Path subDir = new Path(baseDir, "subDir"); localFs.mkdirs(subDir); localFs.create(new Path(subDir, TEST_FILE_NAME2)); List<FileStatus> testFiles = FileListUtils.listPathsRecursively(localFs, baseDir, new PathFilter() { @Override public boolean accept(Path path) { return true; } }); Assert.assertEquals(4, testFiles.size()); Set<String> fileNames = Sets.newHashSet(); for (FileStatus testFileStatus : testFiles) { fileNames.add(testFileStatus.getPath().getName()); } Set<String> expectedFileNames = Sets.newHashSet(); expectedFileNames.add(baseDir.getName()); expectedFileNames.add(subDir.getName()); expectedFileNames.add(TEST_FILE_NAME1); expectedFileNames.add(TEST_FILE_NAME2); Assert.assertEquals(fileNames, expectedFileNames); } finally { localFs.delete(baseDir, true); } }
public static List<FileStatus> listPathsRecursively(FileSystem fs, Path path, PathFilter fileFilter) throws IOException { return listPathsRecursivelyHelper(fs, Lists.<FileStatus>newArrayList(), fs.getFileStatus(path), fileFilter); }
FileListUtils { public static List<FileStatus> listPathsRecursively(FileSystem fs, Path path, PathFilter fileFilter) throws IOException { return listPathsRecursivelyHelper(fs, Lists.<FileStatus>newArrayList(), fs.getFileStatus(path), fileFilter); } }
FileListUtils { public static List<FileStatus> listPathsRecursively(FileSystem fs, Path path, PathFilter fileFilter) throws IOException { return listPathsRecursivelyHelper(fs, Lists.<FileStatus>newArrayList(), fs.getFileStatus(path), fileFilter); }  }
FileListUtils { public static List<FileStatus> listPathsRecursively(FileSystem fs, Path path, PathFilter fileFilter) throws IOException { return listPathsRecursivelyHelper(fs, Lists.<FileStatus>newArrayList(), fs.getFileStatus(path), fileFilter); }  static List<FileStatus> listFilesRecursively(FileSystem fs, Path path); static List<FileStatus> listFilesRecursively(FileSystem fs, Iterable<Path> paths); static List<FileStatus> listFilesToCopyAtPath(FileSystem fs, Path path, PathFilter fileFilter,
      boolean includeEmptyDirectories); static List<FileStatus> listFilesToCopyAtPath(FileSystem fs, Path path, PathFilter fileFilter,
      boolean applyFilterToDirectories, boolean includeEmptyDirectories); static List<FileStatus> listFilesRecursively(FileSystem fs, Path path, PathFilter fileFilter); static List<FileStatus> listFilesRecursively(FileSystem fs, Path path, PathFilter fileFilter,
      boolean applyFilterToDirectories); static List<FileStatus> listMostNestedPathRecursively(FileSystem fs, Path path); static List<FileStatus> listMostNestedPathRecursively(FileSystem fs, Iterable<Path> paths); static List<FileStatus> listMostNestedPathRecursively(FileSystem fs, Path path, PathFilter fileFilter); static List<FileStatus> listPathsRecursively(FileSystem fs, Path path, PathFilter fileFilter); static FileStatus getAnyNonHiddenFile(FileSystem fs, Path path); }
FileListUtils { public static List<FileStatus> listPathsRecursively(FileSystem fs, Path path, PathFilter fileFilter) throws IOException { return listPathsRecursivelyHelper(fs, Lists.<FileStatus>newArrayList(), fs.getFileStatus(path), fileFilter); }  static List<FileStatus> listFilesRecursively(FileSystem fs, Path path); static List<FileStatus> listFilesRecursively(FileSystem fs, Iterable<Path> paths); static List<FileStatus> listFilesToCopyAtPath(FileSystem fs, Path path, PathFilter fileFilter,
      boolean includeEmptyDirectories); static List<FileStatus> listFilesToCopyAtPath(FileSystem fs, Path path, PathFilter fileFilter,
      boolean applyFilterToDirectories, boolean includeEmptyDirectories); static List<FileStatus> listFilesRecursively(FileSystem fs, Path path, PathFilter fileFilter); static List<FileStatus> listFilesRecursively(FileSystem fs, Path path, PathFilter fileFilter,
      boolean applyFilterToDirectories); static List<FileStatus> listMostNestedPathRecursively(FileSystem fs, Path path); static List<FileStatus> listMostNestedPathRecursively(FileSystem fs, Iterable<Path> paths); static List<FileStatus> listMostNestedPathRecursively(FileSystem fs, Path path, PathFilter fileFilter); static List<FileStatus> listPathsRecursively(FileSystem fs, Path path, PathFilter fileFilter); static FileStatus getAnyNonHiddenFile(FileSystem fs, Path path); static final Comparator<FileStatus> LATEST_MOD_TIME_ORDER; static final PathFilter NO_OP_PATH_FILTER; }